agent-ops
Operations an agent can request via state/output.md.
- License 许可
- Apache-2.0
- 所属仓库
- usurobor/cnos
- 最近更新
- 2026-11-07
- Stars
- ★ 9
- Forks
- 0
01 前言 Front Matter
- name
- agent-ops
- scope
- task-local
- triggers
- [ "ops", "status", "doctor", "hub", "maintenance" ]
- description
- Operations an agent can request via state/output.md.
- activation_status
- on-demand — not activation-loaded since cycle/385. Describes the OCaml-era daemon contract (src/ocaml/cmd/cn_agent.ml, src/ocaml/lib/cn_lib.ml). Not load-bearing for the current Go activation path (src/go/internal/activate/activate.go). Kept for the planned cn agent runtime per README. Load on-demand only.
- governing_question
- How does the agent declare an op on output.md so the harness can route and execute it?
02 资源文件 26
- 资产文件assets/evidence_ledger_template.csv581 B
- 资产文件assets/falsification_controls_template.json5.7 KB
- 资产文件assets/hypothesis_record_template.json13.4 KB
- 资产文件assets/operationalization_template.json2.2 KB
- 资产文件assets/prediction_rival_matrix_template.csv1.6 KB
- 资产文件assets/preregistration_scaffold_template.md5.0 KB
- 资产文件assets/search_boundary_template.json1.1 KB
- 资产文件assets/source_ledger.csv14.8 KB
- 参考文档references/causal_inference_and_claims.md7.8 KB
- 参考文档references/concepts_and_workflow.md7.2 KB
- 参考文档references/ethics_safety_and_ai.md10.3 KB
- 参考文档references/experimental_design_patterns.md9.5 KB
- 参考文档references/hypothesis_quality_criteria.md7.8 KB
- 参考文档references/literature_search_strategies.md7.9 KB
- 参考文档references/preregistration_and_open_science.md7.6 KB
- 参考文档references/security_validation.md4.1 KB
- 参考文档references/source_ledger.md9.8 KB
- 参考文档references/tool_reference.md8.2 KB
- 脚本scripts/_common.py15.0 KB
- 脚本scripts/audit_evidence_ledger.py11.8 KB
- 脚本scripts/check_falsification_controls.py16.1 KB
- 脚本scripts/check_operationalization.py7.9 KB
- 脚本scripts/generate_preregistration_scaffold.py14.0 KB
- 脚本scripts/lint_causal_claims.py6.6 KB
- 脚本scripts/validate_hypothesis_schema.py38.0 KB
- 脚本scripts/validate_prediction_matrix.py9.6 KB
03 SKILL.md 正文
Agent Ops
Operations an agent can request via state/output.md.
Overview
When processing input.md, the agent writes output.md with:
- Required
idfield matching input's id - Optional legacy coordination operation fields in frontmatter
- Optional typed capability ops in
ops: - Response body
cn parses output.md and executes any valid operations found.
There are two layers:
- Legacy coordination ops — reply, send, done, defer, etc.
- Typed capability ops — CN Shell observe/effect requests in
ops:
Use coordination ops for thread / routing / lifecycle intent.
Use typed ops when you need cn to inspect or mutate governed workspace state.
Legacy Coordination Ops
All operations go in output.md frontmatter as key: value.
ack
Acknowledge input without further action.
ack: <input-id>
done
Mark input or thread as complete.
done: <id>
fail
Report failure to process, with reason.
fail: <id>|<reason>
Example: fail: review-123|missing context
reply
Append reply to an existing thread.
reply: <thread-id>|<message>
send
Send message to a peer (queues to outbox).
send: <peer>|<message>
send: <peer>|<message>|<body>
message— brief summary (appears in notification)body— full response text (optional, but recommended for detailed replies)
If body is omitted but output.md has content below frontmatter, that content SHOULD be used as body.
delegate
Forward thread to another agent.
delegate: <thread-id>|<peer>
defer
Postpone thread until later.
defer: <id>
defer: <id>|<until>
delete
Discard a thread.
delete: <id>
surface (alias: mca)
Surface an MCA for community pickup.
surface: <description>
mca: <description>
Example Output
---
id: review-pi-proposal
done: review-pi-proposal
surface: Add retry logic to wake mechanism
---
# Review Complete
Reviewed Pi's proposal. Approved with minor suggestions.
The wake mechanism could use retry logic - surfacing as MCA.
Typed Capability Ops (ops:)
Typed capability requests go in a single-line JSON array in frontmatter:
---
id: review-pi-proposal
ops: [{"kind":"fs_read","path":"src/agent/mindsets/COHERENCE.md"}]
---
I need to inspect the coherence mindset before deciding.
Important
ops:MUST be frontmatter, not body textops:MUST be JSON, not XML, not YAML, not pseudo-code- Do not invent wrappers like
<observe>...</observe> - Do not emit shell commands like
cat fileorgit diff
Common observe ops
fs_readfs_listfs_globgit_statusgit_diffgit_loggit_grep
Common effect ops
fs_writefs_patchgit_branchgit_commitexec(only when explicitly enabled by runtime policy)
Example: ask to inspect a file
---
id: wisdom-check-001
reply: wisdom-check-001|Gathering the relevant file first
ops: [{"kind":"fs_read","path":"src/agent/mindsets/COHERENCE.md"}]
---
I want to read the coherence mindset before I answer.
Example: ask to inspect, then later patch
Pass A:
---
id: fix-readme-001
ops: [{"kind":"fs_read","path":"README.md"}]
---
Let me inspect the README first.
Pass B (after cn feeds back evidence):
---
id: fix-readme-001
reply: fix-readme-001|I prepared a patch
ops: [{"kind":"fs_patch","op_id":"patch-001","path":"README.md","unified_diff":"..."}]
---
Here is the proposed README fix.
When to use which layer
- Need to reply / route / complete / defer → use legacy coordination ops
- Need to read / diff / patch / branch / commit / exec → use
ops:
N-pass intuition
If you request observe ops, cn runs a bounded N-pass loop so you can see the evidence
before proposing effects. Do not assume you can observe and mutate in one step.
The loop continues (up to max_passes) as long as there are typed ops to execute.
Rules
idfield is required and must match input's id- Multiple operations are allowed in a single output
- Legacy coordination ops execute in frontmatter order
- Typed capability ops are validated under policy; unknown or invalid ops are denied
- IO pair is archived to logs/input/ + logs/output/ before executing effects (per TRACEABILITY.md §11.1 — IO-pair evidence layer)
cnlogs operations to system log (stdout, captured by systemd/cron)- Never emit XML-style pseudo-tool syntax
RACI: A vs I
When assigning work or escalating issues:
| If you... | You are... |
|---|---|
| Can investigate/act yourself | A (Accountable) — own it |
| Cannot act, only need to know | I (Informed) — receive updates |
The test: "Can I do something about this myself?"
- Yes → You're A. Do it.
- No → You're I. Pass it with clear reason why you can't act.
Anti-pattern: Filing issues as "I" when you could investigate. This passes the buck.
Example:
- ❌ "Version string bug. Sigma to investigate." (passing as I)
- ✅ "Version string bug. I found: binary reports 2.1.21, dune-project has 2.1.22. Root cause: cn_lib.ml not bumped. Fix: bump + rebuild + republish." (owned as A, then delegated with context)
When You See Something, Say Something
If you observe an issue — don't just note it and move on.
The problem: Noticing something broken, marking it "already handled" or "not my job," and continuing. The issue rots. No one owns it.
The MCA when you observe an issue:
- Capture it — Write a clear description: what's broken, repro steps, impact
- Assign it — Route to the right owner (use
send:orsurface:) - Track it — Add to backlog with priority
- Follow up — Don't let it rot
Example:
You notice input.md hasn't cleared in 45 hours despite output.md being written.
❌ Wrong: "Same stale input, already processed. HEARTBEAT_OK." (You noted it. You moved on. The issue persists.)
✅ Right:
surface: Actor model stuck — input.md not clearing after output.md written. Blocking Pi↔Sigma coordination. P1.
send: sigma|Actor model issue: input.md stuck since Feb 7. output.md exists but cn process didn't clear. Can you check?
(Captured. Assigned. Tracked.)
The test: "Did I leave the system better than I found it?"
If you saw a problem and didn't create a traceable work item, the answer is no.
Types (OCaml)
type agent_op =
| Ack of string
| Done of string
| Fail of string * string
| Reply of string * string
| Send of string * string
| Delegate of string * string
| Defer of string * string option
| Delete of string
| Surface of string
Typed capability ops are represented separately by the CN Shell typed-op schema.
04 同仓库更多 Skills
issues/triage
Issue triage doctrine pointer. Use when classifying a new issue, deciding dispatch eligibility, or deciding whether to close/supersede/defer.
issues/taxonomy
Issue label taxonomy pointer. Use when classifying an issue's kind/area/priority/effort/status/protocol/dispatch labels, or when the board needs to interpret them.
issues/map
Issue-board (Issue Pivot) generation domain. Use when reasoning about `cn issues map`'s fetch, taxonomy-parse, effort-computation, and render pipeline, or about the board's JSON/HTML output contract.
issues
cnos.issues package entrypoint. Use when reasoning about issue taxonomy, the Issue Pivot / issue-board (`cn issues map`), the read-only CDS issue-state evaluator (`cn issues fsm evaluate`), or the current command-dispatch disposition of issue tooling.
receipt-stream
Cross-cycle receipt-stream doctrine for protocol-iteration. Use when γ closes a cycle and writes the per-cycle iteration artifact (`cdd-iteration.md`), when γ updates the cross-cycle aggregator at `.cdd/iterations/INDEX.md`, when ε reads the receipt stream across cycles to surface protocol-gap patterns, when a finding's disposition lands a cross-repo patch and the cross-repo trace bundle attaches, or when a courtesy empty-findings stub is written for a `protocol_gap_count == 0` cycle.
mid-flight
Mid-flight γ→in-flight-α rescue channel. Use when γ needs to change a load-bearing fact (pinned axis, scope, AC, blocker) after α has begun coding, when γ edits the cycle's GitHub issue body mid-cycle, or when a spec change lands on origin/main while α/β polling sessions are in-flight.