Support checked-in .caos/agent.json repository instructions - #166
Open
nishu-builder wants to merge 1 commit into
Open
Support checked-in .caos/agent.json repository instructions#166nishu-builder wants to merge 1 commit into
nishu-builder wants to merge 1 commit into
Conversation
A repository can now steer the agent with a checked-in
.caos/agent.json: {"instructions": "<standing guidance>"}. llm-step
rereads it from the CURRENT workspace on every round — the same
freshness contract as the tool registry — and appends it to the curried
system prompt, so every turn (publish preparation included) runs under
the repository's own build/test/convention rules. Unknown fields are
ignored so the schema can grow under harnesses already baked into
worker images; a malformed file fails the round loudly.
agent.json becomes the ONE .caos entry a workspace may carry at rest:
- conversation bases and /update-tree proposals accept it (client
reject_reserved_caos and llm-step's base guard both list the entries
and refuse anything else under .caos, naming the offenders);
- the publish tip check allows it while still refusing a leftover
.caos/conflicts;
- inline read/write/edit treat it like any file;
- a subagent's snapshot keeps it (and only it) when the parent's .caos
harness state is stripped;
- the TUI workspace diff hides only .caos/conflicts now, so an edit to
the instructions shows up for review.
With validation policy owned by the repository, the publication
preparation request no longer imposes a generic "build and test" step.
The merge tool's post-conflict guidance keeps its build-and-test hint:
that text serves conflict resolution generally, not pre-push policy.
tests/agent-instructions drives a scripted turn end to end: a base
carrying only .caos/agent.json is admitted and the stubbed request's
system prompt carries the instructions verbatim, while a base with any
other .caos entry is still refused before admission.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019FKeyxNMPfqcUR2Ts9ghqq
nishu-builder
force-pushed
the
claude/pr-publishing-caos-agent-mil3g8-3-agent-json
branch
from
August 28, 2026 22:28
fa9e13a to
5b1cfac
Compare
This was referenced Aug 28, 2026
Contributor
Author
|
Full caos suite run ( Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Independent PR based on
main(replaces #161, which GitHub had locked into a managed stack; merges cleanly in any order with #159 and #165).A repository can now steer the caos agent with a checked-in
.caos/agent.json:{"instructions": "Build with `nix build`. Run the `test` tool before finishing a change."}Harness (
std/llm-step): the file is reread from the current workspace on every round — the same freshness contract as the tool registry — and itsinstructionsstring is appended to the curried system prompt, so every turn (the publish preparation turn included) runs under the repository's own rules. Unknown fields are ignored so the schema can grow under harnesses already baked into worker images; a malformed file fails the round loudly rather than silently running without the repository's rules.agent.jsonbecomes the one.caosentry a workspace may carry at rest:/update-treeproposals accept it — both the client'sreject_reserved_caosand llm-step's first-turn base guard now list.caos's entries and refuse anything else, naming the offenders;.caos/conflicts(even an empty one);read/write/edittools treat it like any other file;.caosharness state is stripped;.caos/conflicts, so an edit to the instructions shows up for review. The merge worker already preserves it (git archiveof the merged tree).With validation policy owned by the repository, the publication preparation request drops the generic "Build and test" — a repo that wants gates before a PR names them in its own instructions. The merge tool's post-conflict "build and test" hint is deliberately untouched: it serves conflict resolution generally, not pre-push policy.
Docs updated where the reserved-
.caosrule is stated (SPEC.md — new "Repository agent instructions" section — design/chat.md, TUI.md).Tests: new
tests/agent-instructionssuite in the current worker.sh/.caos-expr harness shape (cli-test base) drives a scripted turn end to end — a base carrying only.caos/agent.jsonis admitted, the stubbed request'ssystemcarries the instructions verbatim (appended, not replacing the curried prompt), the conversation head keeps the file, and a base with any other.caosentry is still refused before admission. Unit tests cover the JSON parsing, the system composition, the inline-tool path guard, and both client guards.Note on rollout: this PR deliberately does not add a
.caos/agent.jsonto the caos repo itself. A worker image only picks up the new harness aftercaosd reset(CLAUDE.md), so checking the file in before stacks are reset would make older deployed clients refuse the base tree. Adding caos's own instructions file is a natural follow-up once this lands and stacks are rebuilt.Generated by Claude Code