Skip to content

feat(cli): scaffold AGENTS.md and print next steps after deploy - #94

Closed
jonoirwinrsa wants to merge 1 commit into
mainfrom
feat/cli-agent-discoverability
Closed

feat(cli): scaffold AGENTS.md and print next steps after deploy#94
jonoirwinrsa wants to merge 1 commit into
mainfrom
feat/cli-agent-discoverability

Conversation

@jonoirwinrsa

Copy link
Copy Markdown
Contributor

⚠️ Merge after #92 and #93. Points at main and touches different files, so it won't conflict — but the text it ships references --output json and cerebrium metrics resources, which don't exist until those land. Merging this first would hand every new project instructions for commands that fail.

Why

#92 and #93 make the CLI machine-readable. Neither makes it discoverable. Agents run --help to learn a command's flags once they already suspect it exists — they don't run it speculatively to find out that cerebrium metrics is a thing. Left alone, those two PRs would ship commands the intended audience never learns about.

Two changes, both aimed at the moments an agent is already reading.

cerebrium init writes an AGENTS.md. Agents read this at the start of a session unprompted, which makes it the only place instructions reliably land before any work begins. Generated for cerebrium init sentiment-api:

# sentiment-api

A Cerebrium app. `main.py` holds the functions that get served; `cerebrium.toml` declares
hardware, scaling and dependencies.
...
## Checking a deploy worked

Do not assume a deploy is live because the command exited 0. Verify it:

    cerebrium containers list sentiment-api     # what is running right now
    cerebrium logs sentiment-api                # runtime logs
    ...

It also covers the two things that read as failures but aren't: scale-to-zero meaning containers list correctly returns nothing on an idle app, and hardware/dependency changes needing a redeploy.

cerebrium deploy ends with next steps. An agent reliably reads the output of the command it just ran, and deploy exiting 0 only means the build succeeded — not that the app serves traffic.

Next steps:
  cerebrium logs my-app                  stream runtime logs
  cerebrium containers list my-app       see what is running
  cerebrium metrics resources my-app     check CPU, memory and GPU usage

Decisions worth challenging

AGENTS.md, not CLAUDE.md. It's the vendor-neutral convention and Claude Code reads it, so one file covers more tools. If you'd rather write both, or append to an existing CLAUDE.md when one is present, say so — it's a small change.

init only, so existing projects get nothing. Backfilling would mean either a new command (cerebrium agents init) or writing files into projects during unrelated commands, which I didn't want to do unasked. The deploy output covers existing projects in the meantime.

Testing

go build, go vet, go test ./... clean. No golden files regenerated — deploy's success block prints to scrollback via tea.Println rather than through View(), so nothing golden captures it.

New tests cover the generated AGENTS.md (names the right commands, no unfilled format verbs — a stray %! would ship a broken file to every new project) and next-step alignment in both coloured and plain modes. Ran cerebrium init for real and read the output file; it's reproduced above.

The deploy output itself is unit-tested but I have not watched it print from a real deploy, since that means a live build.

Shipping machine-readable commands does not mean agents will find them. Agents
run --help to learn a command's flags, not to discover that a capability they
had no reason to expect exists. Two changes put the commands in front of them.

`cerebrium init` now writes an AGENTS.md alongside main.py and cerebrium.toml.
Coding agents read that file at the start of a session without being asked, so
it is the one place instructions are seen before any work begins. It covers
verifying a deploy, right-sizing hardware from measured usage, and the traps
that look like failures — scale-to-zero returning no containers, and config
changes needing a redeploy.

`cerebrium deploy` now ends with the commands worth running next. An agent
reliably reads the output of the command it just ran, and a deploy exiting 0
only means the build succeeded, not that the app is serving.

Next-step padding is measured on the uncoloured command, since padding a string
that already carries escape codes skews every row.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jonoirwinrsa

Copy link
Copy Markdown
Contributor Author

probably not the right thing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant