Practical guidance for coding agents working in bare.
bare is a deterministic coding-agent runtime and CLI. Favor predictable behavior, schema stability, and debuggable run artifacts over cleverness.
Before non-trivial changes, read:
README.mddocs/model-architecture.mddocs/adding-provider.mddocs/adding-model.mddocs/model-troubleshooting.mddocs/adr/0001-provider-model-architecture.md
- CLI:
cmd/bare/ - Core domain/config/state:
internal/domain/ - Model/provider layer:
internal/model/ - Command execution:
internal/execution/ - Runtime persistence:
internal/storage/,internal/proof/ - Troubleshooting and architecture docs:
docs/ - Task backlog + schema:
to-do.json,to-do.schema.json
- Build:
go build -o bare ./cmd/bare - CLI smoke check:
go run ./cmd/bare --help - Full tests:
go test ./... - Fast model + CLI loop checks:
go test ./internal/model ./cmd/bare
- Review mode (PR/issue context only): read-only review, no code edits, no branch switching, no commits.
- Landing mode (implementation requested): make scoped changes, run required tests, then summarize artifacts and outcomes.
- For changes in
internal/model,cmd/bare, orinternal/domain, run:go test ./internal/model ./cmd/bareduring iteration.go test ./...before finalizing.
- For documentation-only edits, tests are optional but preferred when behavior text changed.
- Keep provider behavior deterministic and capability-driven (
internal/model/models.json). - Do not change provider request/response contracts without tests and doc updates.
- Preserve normalized diagnostics/error classification so retries and transcripts stay stable.
- Z.AI defaults currently use
chat_completionsand endpoint familyhttps://api.z.ai/api/paas/v4/.... - Z.AI auth requires full token format
<key_id>.<secret>inZAI_API_KEY. - Be aware default model output budget is limited; large prompt responses can truncate. If you change extraction/fallback logic, add tests for partial JSON/text behavior.
- Any provider wire change (payload shape, endpoint resolution, auth header, response parser, error classification, retry behavior) must include:
- targeted unit/integration tests in
internal/model/*test.go(andcmd/bare/*test.gowhen transcript behavior changes), - operator-facing doc updates in
README.mdand/ordocs/model-troubleshooting.md, - backward-compatibility notes when behavior differs from prior releases.
- targeted unit/integration tests in
For model/loop failures, inspect these first:
.bare/outputs/runs/<run_id>/iteration-*.json.bare/outputs/runs/<run_id>/run.log.bare/outputs/runs/<run_id>/events.jsonl.bare/transcripts/runs/<run_id>/session.jsonl
Prefer concrete evidence from run artifacts over assumptions.
- Keep
to-do.jsoncompliant withto-do.schema.json. - Required task fields:
id,title,priority,status. - Allowed task status values:
todo,doing,blocked,done. - When creating tasks, include actionable
details, concretesteps, and affectedfiles.
- Keep changes minimal and local; avoid broad refactors unless requested.
- Add or update tests whenever behavior changes.
- Run targeted tests for touched packages before finalizing.
- Do not commit secrets, tokens, or private environment values.
- Use Conventional Commit format:
type(scope): summary. - Commit only task-scoped files; do not include unrelated workspace churn.
- Do not run version bumps, tagging, release, or publish commands without explicit user approval.
- If asked to push, first ensure required tests have passed in this workspace.
- Do not revert or reformat unrelated files.
- Do not use destructive git commands unless explicitly requested.
- If the tree is already dirty, scope your changes and report only files you touched.
- Do not use
git stash(including autostash),git worktree, or branch switching unless explicitly requested. - Never discard other agents' in-progress changes to make your task easier.
Maintain LESSONS_LEARNED.md for high-value discoveries:
- Add one short entry when you resolve a non-obvious issue.
- Format: date, symptom, root cause, fix, and prevention check.