Skip to main content
An incident rarely lives in one layer. The pod won’t go up — is it the Argo manifest? the Terraform node group? the health check in code? This recipe indexes all three layers as separate knowledge bases with @docs-flatten kind=code and lets the agent cross the bases to find the root cause.

The Problem

The checkout-api Rollout is stuck in Progressing and never turns Healthy. Looking one layer at a time gets nowhere: the manifest looks right, Terraform applied without error, and the code compiles. The answer is at the seam — and it’s spread across three repositories.

Ingredients

  • The application repository (service code).
  • The infra Terraform module (cluster, node groups).
  • The GitOps repository (Argo/Kubernetes manifests).
  • ChatCLI with the builtin @docs-flatten tool (included).
No API key required: knowledge mode uses pure-Go BM25 by default. Embeddings (Voyage/OpenAI/Bedrock) are an optional boost.

Step by Step

1

Index each layer as a base

kind=code slices each repo by structure — functions, Terraform resources, manifests — with symbol/resource titles, instead of one text blob:
@docs-flatten root=./checkout-api  kind=code format=jsonl output=app.jsonl
@docs-flatten root=./infra-eks     kind=code format=jsonl output=infra.jsonl
@docs-flatten root=./gitops-argo   kind=code format=jsonl output=argo.jsonl
Noise (vendor/, .terraform/, lockfiles, binaries) is skipped automatically, and files above 1 MiB are ignored.
2

Create and attach the three bases

/context create app   app.jsonl   --mode knowledge
/context create infra infra.jsonl --mode knowledge
/context create argo  argo.jsonl  --mode knowledge

/context attach app && /context attach infra && /context attach argo
Each attach costs only an index card (~900 tokens, fixed) in the prompt — all three together stay cheap, even with large repos.
3

Ask across the layers

In /agent (or /coder), describe the symptom and let the AI connect. @knowledge search fans out across the three bases, tagging each passage by its source base:
/agent the checkout-api Rollout stays in Progressing and never goes Healthy.
       connect the Argo manifest, the Terraform node group and the
       readiness/health check in the service code.
Under the hood, the agent investigates iteratively:
→ @knowledge search "checkout-api Rollout readiness"      (base: argo)
→ @knowledge search "node group taints capacity"          (base: infra)
→ @knowledge search "health readiness endpoint port"      (base: app)
→ @knowledge get "argo/rollout-checkout.yaml"
4

Get the cross-layer diagnosis

With passages from all three layers in the same reasoning, the AI connects the dots — for example:
The Rollout/checkout-api (argo) sets readinessProbe on port 8080, but the service (app, server.go) listens on 8081; and aws_eks_node_group.workers (infra) has a dedicated=checkout taint the Rollout doesn’t tolerate. Two compounding factors: the probe never passes and the pods don’t even schedule onto the right nodes.
The base is read-only — it gives understanding. To apply the fix and run the tests, use /coder on the live repo with @read/@search/@coder.

Why it works

Automatic fan-out

@knowledge search queries all attached bases at once; each hit is tagged by its source base, so the model knows which layer it came from.

Structure-aware slicing

Terraform resources, K8s manifests and functions become their own chunks with titles (aws_eks_node_group.workers, Rollout/checkout-api) — search lands on the right spot.

Fixed cost

A ~900-token index card per base, regardless of repo size. Three layers still fit in the prompt.

Keyless

Pure-Go BM25 covers everything with no API key; identifiers (getReadiness, checkout_api) are found by their parts thanks to camelCase/snake splitting.
You don’t have to say “this is code” for each repo: the agent picks kind=code on its own from intent and a self-correcting hint. See Knowledge Base.

Next steps

Knowledge Base

Persistent Contexts

Coder Mode

K8s Monitoring