Command Layer
In an Agent Development Environment, a repository exposes two main interfaces to the people and coding agents working in it:
- A knowledge interface (
AGENTS.md, canonical docs, feature contracts, schemas), which records how the system is structured, what behavior is intended, and where decisions live. - An operational interface–the command layer (
Taskfile.yml,Makefile, and the scripts behind them)–which defines how to act on the system: setting up a checkout, running checks, starting and inspecting local services, collecting diagnostics, running evaluations, and operating remote infrastructure.
Each command wraps the underlying tools, flags, environment variables, and step order behind a stable name such as task quality:verify or task db:up. Developers, coding agents, git hooks, and CI jobs invoke the same entry points instead of reconstructing raw shell pipelines. Across a project, those commands support more than code checks: they cover workspace provisioning (repo:init), implementation and contract sync (quality:verify, api:schema), runtime investigation (db:status, collect-query-context), behavioral evaluation (scenario:e2e, eval:*), and remote infrastructure (infra:*).
In the ADE architecture, the command layer is the first part under Commands and Tools, and it runs the environment’s computational guides and sensors. This note calls an entry in the task runner a command rather than a task, because task in these notes refers to a unit of engineering work (Task directory). Examples throughout come from python-repo-template and seven sibling projects listed in Projects.
Problems without a command layer
Without a command layer, operational workflows are scattered across README.md, shell scripts, Docker Compose files, git hooks, and CI workflows. Developers memorize the subset they run often, while newcomers piece workflows together by reading configuration files or asking teammates. Because coding agents retain no memory across sessions, they enter every session as that newcomer:
- Agents fall back on generic tool habits. Left to its training priors, an agent runs
pip installin auvproject, invokes barepytestwithout the project’s flags, or runs hostnpmwhen the frontend toolchain lives in a container. - Multi-step workflows get rebuilt by hand. Bringing up a local environment or running end-to-end tests often requires starting a database container, waiting until it accepts connections, passing host user IDs or profile settings, starting the API, and cleaning up afterward. Reconstructed manually, steps get skipped or run out of order.
- Safe and costly actions look alike. A script that provisions a billed remote GPU pod or deletes a database volume looks like any other
bash scripts/...invocation. - Tool details drift across files. When
AGENTS.md, the runbook, git hooks, and CI each spell out raw tool invocations, changing how a tool runs (for example, moving type checking into a pinned container) leaves stale commands behind in whichever files were missed.
Where developers and agents differ
Most of what makes a command layer effective for agents is ordinary developer experience. Still, a command set built around human terminal habits often fails coding agents in five places:
- Cold-start discovery and priors. A developer learns a project’s handful of daily commands once and stops reading
help. An agent starts every session with generic engineering priors and discovers local workflows fromAGENTS.mdand the command catalog. Often, a command’s name and one-line description are all the agent sees before choosing whether to run it. - Returning vs. foreground processes. A developer happily leaves a server running in the foreground of a terminal tab and stops it with
Ctrl+C. In an agent’s sequential tool loop, a command that never exits blocks the turn unless the harness backgrounds it and polls separately. Agents work far more reliably when service-start commands detach and return as soon as health checks pass. - Interactive prompts. Commands like
sem-rag’smake docker-db-shellopen an interactivepsqlsession, which suits a human exploring a database. An agent needs non-interactive commands that accept a query or identifier as an argument, print output, and exit. - Observability through files and status commands. Humans watch streaming terminal output or click around a browser UI. Agents diagnose bugs and verify fixes by running status commands, reading logs at predictable file paths, and calling diagnostic collectors that bundle traces and logs for a specific request.
- Mechanical risk gates and parallel workspaces. A human pauses before running a script that bills a cloud GPU or wipes local state, and usually runs one stack at a time. For an agent, side effects and cost must be reflected in command names (
infra:*,--dry-run,downvs.clean) so harness permission settings (allow,ask,deny) can gate them; and when multiple agents work concurrently across git worktrees, local stacks need isolated ports, project names, and volumes so they do not collide.
Structure of the command layer
A well-structured command layer makes workflows easy to discover from a single catalog, groups commands by clear subsystem boundaries, and composes end-to-end scenarios out of smaller building blocks.
Finding commands
Both a new developer and an agent in a fresh session need one predictable command that prints every workflow the repository supports.
In repositories using Go Task (python-repo-template, knowledge-assistant, lang-assistant, and the repos inside medicine-doctor), task help runs task --list, building the catalog directly from each command’s desc field. AGENTS.md then needs only a single routing rule. knowledge-assistant writes:
Use
task <namespace>:<name>for repository workflows andtask helpfor the current catalog. If no task exists, useuv run <tool>.
Other projects in the set combine two runners. wallet places GNU Make in front of Poe the Poet (poe_tasks.toml under backend/), while sem-rag and wallet-evals use Make for Docker, Compose, and setup alongside Poe for Python checks, migrations, and diagnostics. Splitting runners works, and Poe handles positional CLI arguments cleanly, but it adds friction for agents:
In multi-repository workspaces, keeping each repository’s command layer self-contained prevents cross-repo confusion. medicine-doctor is a parent folder holding separate backend, frontend, and evaluation repositories rather than a monorepo; its root AGENTS.md instructs agents to read each repository’s own AGENTS.md and run commands only from that repository’s root.
Namespaces
Namespaces group commands by the subsystem or concern they act on. In Go Task, : separates levels of hierarchy (db:up, quality:fmt:check, infra:runpod:embedding:pod), so related commands sort together in task help and a template test can verify that every public command (apart from default and help) belongs to a namespace. Flat Make targets can approximate this with consistent prefixes (docker-up, docker-logs, docker-down), though nothing enforces the convention.
python-repo-template starts every repository with four baseline namespaces:
As a project grows, explicit ownership rules keep namespaces from blurring together. knowledge-assistant defines ten namespaces and documents both what each namespace owns and what it does not own in docs/evergreen/commands.md:
The “Does not own” boundary prevents hidden side effects: even though the API depends on Qdrant, app:dev starts only the API, leaving Qdrant strictly to db:*. Multi-service startup belongs explicitly to scenario:*. As commands.md states: “Use the lowest-level command that owns the work. Use a scenario when the desired outcome requires more than one subsystem.”
Subsystem commands and scenarios
Commands across these projects fall into three layers of abstraction:
- Raw tool calls (
uv run pytest ...,docker compose up -d qdrant), which appear only insideTaskfile.yml,Makefile, or helper scripts. - Subsystem commands (
db:up,app:dev,quality:type,quality:test), each performing one operation on a single subsystem. - Scenarios and composite gates (
scenario:local:up,scenario:e2e,quality:verify), which sequence subsystem commands to complete a cross-cutting workflow.
In knowledge-assistant, local scenarios compose config:*, db:*, and app:* commands directly in Taskfile.yml:
scenario:local:up:
desc: Start Qdrant, then run the selected local application in the foreground
cmds:
- task: db:up # docker compose up -d qdrant, then wait for readiness
- task: app:dev # FastAPI on port 8766
scenario:local:down:
desc: Stop Qdrant after the foreground application has been stopped
cmds:
- task: db:down
scenario:local:status:
desc: Show the selected profile and local database status
cmds:
- task: config:show
- task: db:statusKeeping both levels exposed matters when things break. A caller runs task quality:verify or task scenario:e2e for the normal workflow without remembering step order or teardown. In lang-assistant, scenario:e2e spins up a dedicated mock stack, runs Playwright browser tests, and tears down the stack on exit whether the tests pass or fail; scenario:demo resumes the remote GPU pod, starts the local stack, and preloads sample text. When a composite command fails, the atomic commands (db:status, db:logs, quality:type) remain available in the catalog to isolate the fault.
What counts as a “stack” or “scenario” depends on where services run. lang-assistant puts its API, frontend, and SSH tunnel in Compose, so a single stack:* namespace manages all local containers. knowledge-assistant deliberately has no stack:* namespace: Qdrant runs in Compose (db:*), the Python API runs on the host (app:*), and the browser UI lives in knowledge-assistant-frontend with its own container lifecycle and an OpenAPI contract (openapi.json) exported from the backend via task api:schema.
Designing commands for workflows
Baseline verification gates
For code and configuration changes, AGENTS.md needs one exact command that defines the baseline check (Define done and when to ask). In the Go Task projects, task quality:verify runs quality:fmt:check, quality:lint, quality:type, and quality:test in sequence, stops at the first failure, and modifies no tracked files. Other hooks reuse the same building blocks: python-repo-template’s pre-commit hook calls task security:scan:staged, the same staged secret scan an agent can invoke before committing. Because the gate is read-only and deterministic, an agent can run it mid-session without side effects, and a passing run means the same thing locally and in CI.
Commands that start services
Making the running application accessible to an agent lets it reproduce bugs, test end-to-end behavior, and gather runtime evidence rather than relying on unit tests alone (Structure and visibility). Four design choices determine whether service commands work cleanly in agent sessions:
- Complete lifecycle sets (
up,status,logs,down).knowledge-assistantprovides all four underdb:*, andlang-assistantprovides all four understack:*. By contrast,wallet(run-stack,logs-stack,stop-stack) andsem-rag(docker-up,docker-logs,docker-down) omit astatuscommand, forcing an agent to drop down to rawdocker compose psor port checks to see whether the stack is already up. - Returning once services are healthy.
knowledge-assistant’sscenario:local:upruns FastAPI in the foreground, holding the terminal until interrupted withCtrl+C–convenient for a human in a dedicated tab, but blocking for an agent unless its harness manages background processes.lang-assistantinstead starts containers withdocker compose up -d --wait, which blocks only until health checks succeed and then returns control to the shell so the agent can run checks, inspect logs, and stop the stack normally. - Predictable log paths and diagnostic bundles. Live log tailing (
docker compose logs -f) is awkward for agents; saved logs and structured diagnostic snapshots are direct inputs to investigation.sem-ragarchives each Compose run’s container logs underdata/logs/compose/runs/<run_id>/, updates symlinks indata/logs/compose/latest/, and prints those paths viamake docker-log-index. Itsuv run poe collect-query-context <query_id>command gathers a single query’s trace, replay payload, container logs, and evaluation records into one directory so a human or an agent investigating a bad answer inspects the exact same bundle. - Parameterized stacks for side-by-side and multi-worktree runs. In
lang-assistant,stack:up,stack:down,stack:status, andstack:logscall a Python script (scripts/devex/local_stack.py) backed byconfig/local-stacks.toml. Passing a short slug (draft,explore,mock) selects an isolated Compose project name, port range, data volume, and inference mode, allowing two stacks to run side by side on one machine. Parallel coding agents working in separate git worktrees need the same per-stack isolation–indexed by worktree or slug–so concurrent runs do not fight over port8000or corrupt a shared database (OpenAI 2026).
Keeping risky commands apart
Command names and namespaces also encode blast radius:
- Local vs. paid or shared remote.
knowledge-assistantandlang-assistantisolate RunPod GPU operations underinfra:runpod:*. Local commands (db:*,stack:*) never create, resume, or bill remote machines; onlyinfra:runpod:*(andlang-assistant’s explicitscenario:demo) touch remote state. - Read-only checks vs. file mutations.
quality:verifyandquality:fmt:checkinspect code without modifying repository files, making them safe to run at any point. Rewriting files happens only inquality:fmt. - Stopping processes vs. deleting data.
db:down,stack:down, andsem-rag’sdocker-downstop containers while preserving volumes. Wiping volumes or generated artifacts requires a separate command (docker-cleanorpoe clean). - Previews before lasting changes.
infra:runpod:plan(andinfra:runpod:embedding:plan) prints the remote machine specification without provisioning anything, andsem-rag’suv run poe clean --dry-runlists files before deleting them.
Separating commands by risk gives harness permission settings clean prefixes to target: a team can allow task quality:* without prompts while requiring human approval (ask) for task infra:*. Prefix rules also reduce configuration drift when multiple agent harnesses share a repository and each maintains its own settings file (Several agent tools in one repository).
However, a command-pattern rule only matches the string passed to the shell. If an agent holds cloud credentials and unrestricted shell access, denying or gating task infra:* does not stop it from calling the underlying Python script or cloud CLI directly. Enforcing risk boundaries starts with removing unnecessary credentials and restricting direct tool access; command namespaces make the remaining approval rules legible and compact (Where an approval rule goes).
Isolating tool dependencies
The command layer can also shield the host machine from secondary toolchains and environment drift:
- Running secondary toolchains in pinned containers.
knowledge-assistantruns Pyright together with Node.js inside a pinned Docker image so the backend repository never installs host Node packages.knowledge-assistant-frontend,wallet, andlang-assistantrun Bun checks, frontend builds, and Playwright browser tests in containers, exposing pass-through commands (task tooling:run -- <args>ormake frontend-bun CMD='<args>') for ad-hoc package operations. Every developer laptop and agent environment then needs only Python,uv, the task runner, and Docker, and runs identical tool versions. - Pairing tool denials with allowed commands. Blocking host tools (
pip,poetry,npm,npx,yarn) in harness deny lists without providing a substitute leaves an agent searching for workarounds. Pairing the denial with a cataloged command–such as forbidding host Node managers inAGENTS.mdand.claude/settings.jsonwhile routing package operations throughtask tooling:run–steers the agent cleanly to the supported path. - Computing host defaults and selecting profiles by name. Commands should compute machine-specific boilerplate rather than asking callers to export variables by hand.
wallet’s Makefile automatically injects the host’sUIDandGIDinto every Compose call;sem-rag’s runbook instead asks users to exportDOC_FORGE_UIDandDOC_FORGE_GIDbeforemake docker-up-build, which is easy to miss on macOS where the user ID rarely matches container UID1000. Likewise, selecting runtime settings via a named profile (KNOWLEDGE_CONFIG=mlx task scenario:local:upfromconfig/runtime.toml, ortask stack:up -- --slug explorefromconfig/local-stacks.toml) lets tracked profile values override.envfor ports and project names, reserving.envfor secrets and machine-local paths so leftover.envedits cannot cross-wire two setups.
Documentation and maintenance
Commands and runbooks
Splitting command knowledge across three files keeps each one focused and avoids duplication:
AGENTS.mdroutes. It names the baseline verification gate (task quality:verify) and points totask helpand the runbook, keeping the always-loaded root file short (Make it a map, not a manual).knowledge-assistantexposes 45 commands intask help, yet itsAGENTS.mdnames only two (quality:verifyandquality:type).- The task runner file specifies how.
Taskfile.ymlowns tool binaries, flags, container mounts, and execution order. When Pyright moves from a local virtualenv into Docker,AGENTS.mdand the runbook stay unchanged because both saytask quality:type. - The runbook specifies when and why.
docs/evergreen/runbook.md(paired inknowledge-assistantwith a dedicateddocs/evergreen/commands.mdfor namespace ownership rules) holds operational procedures: initial setup, indexing, remote GPU recovery, troubleshooting, and steps that require judgment–such as copying.env.exampleto.envonly when.envdoes not exist yet so existing credentials are preserved. Steps that always run in the same unconditional sequence graduate from the runbook into a scenario command; procedures shared across repositories belong in shared agent docs.
Renaming commands
As workflows evolve, the command layer absorbs fixes and renames without breaking existing callers or bloating AGENTS.md:
- Fixing skipped workflow steps in the runner. When an agent repeatedly runs a multi-step procedure by hand and forgets a step, the placement table puts the fix in a task command rather than adding prose to
AGENTS.md(A workflow done by hand). Once added under the appropriate namespace, the new command appears automatically intask help. - Keeping marked compatibility aliases. Renaming a command breaks scripts, docs, and developer habits that still use the old name.
knowledge-assistantretains old names (app:runforapp:cli,search:devforapp:dev,quality:checkforquality:verify) in a dedicated alias block inTaskfile.yml. Each alias’s description starts with"Compatibility alias for ...", andAGENTS.mdnotes that new docs and automation must use canonical names. Becausetask --listprints descriptions alongside names, agents see both and immediately know which one is canonical. - Checking that documented commands and paths still exist. Broken command references fail silently until someone runs them. In the projects reviewed,
knowledge-assistant’sAGENTS.mdcontinued referencingtask frontend:runafter the target was deleted, andsem-rag’smake install-git-hookscontinued pointing Git to.githooksafter that directory was removed, silently disabling pre-commit secret scans. Automated checks–verifying that every command named inAGENTS.mdanddocs/exists inTaskfile.yml, and that hook or script paths exist on disk–prevent silent drift.
What the command layer gives agents
Viewed against the premises and design rules for AGENTS.md (Premises, The rules), each part of the command layer addresses a specific agent failure mode:
Limits and costs
- Agents still have to be pointed to the catalog. Without a routing line in
AGENTS.md, agents often overlookTaskfile.ymlor guess raw commands. Splitting workflows across two runners (such as Make and Poe) doubles the catalog lookup and requires extra routing rules. - Abstraction can obscure failure output. When a wrapped command fails, the agent needs to see which underlying tool ran. Go Task echoes each command before executing it; Make lines prefixed with
@(as insem-rag’sdocker-up) hide the failing command and force the agent to read theMakefile. - Containerized tools depend on Docker access. In cloud sandboxes or restricted environments without a Docker daemon, containerized type checks, frontend builds, and browser tests cannot run, and cold runs pay image-pull latency.
- Read-only code checks can still mutate local state.
quality:verifyleaves tracked files untouched, butuv runmay create or sync.venv, and Make prerequisites likewallet’stest: installmutate the environment before running tests. - Maintenance has an ongoing cost. Like
AGENTS.md, commands and wrapper scripts save session turns and human review effort at the cost of keeping task definitions, container images, and docs aligned as tools evolve.
What to observe
Whether a repository’s command layer actually helps agents shows up in session traces and reviews rather than in how tidy Taskfile.yml looks (Observe agents on real tasks). Useful signals to watch for include:
- Catalog bypasses: raw
pytest,pip,npm, ordocker composecalls when an equivalent task command exists. - Discovery churn: turns spent searching scripts or invoking nonexistent command names (including stale names left in docs).
- Blocked turns: sessions where an agent starts a foreground server or interactive shell and hangs waiting for it to return.
- Permission friction: unexpected approval prompts on routine local checks, or risky commands slipping through without a prompt because they sit outside a gated namespace.
Projects
The examples in this note come from eight projects (four on GitHub and four local-only repositories):
- python-repo-template: Copier template for Python repositories with
uv, Go Task (repo:*,quality:*,security:*,app:*), pytest, a starterAGENTS.md, anddocs/evergreen/runbook.md. - knowledge-assistant: Local workspace for keyword and semantic search over a bounded Markdown corpus, showing source passages and provenance. Runs a host Python API, Qdrant in Compose, and semantic embeddings on Apple Silicon or a RunPod GPU machine.
- knowledge-assistant-frontend: Separate React, TypeScript, Vite, and Bun repository for
knowledge-assistant, running its frontend toolchain inside containers. - lang-assistant: Margin, a local writing workspace that splits text into editable units and proposes unit-level and whole-text alternatives using a private RunPod model over an SSH tunnel, with named Compose stacks in
config/local-stacks.toml. - wallet: Money-tracking app recording what moved, from where, to where, and why, with a local Ollama chat assistant; combines a Python backend (Poe) and containerized Bun frontend behind a root
Makefile. - wallet-evals: Evaluation runner that executes case suites against a sibling
walletcheckout and stores the evidence from each run. - sem-rag:
doc_forge, question answering over a bounded PDF and Markdown corpus with inspectable evidence; runs Postgres, API, worker, and Ollama in Compose, plus an optional Loki, Vector, and Grafana observability stack. - medicine-doctor: Folder of separate repositories for a healthcare AI prototype using synthetic cases (
doctorbackend, React frontend,doctor-evals, and two scaffolds), each with its ownTaskfile.ymlandAGENTS.md.
Sources
The projects the examples come from are listed in Projects.