cadet-agent 0.56.0 → 0.63.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,13 +7,13 @@ Cadet-Agent is **not a one-shot code generator**. It won't spit out a finished g
7
7
  ## Repository Layout
8
8
  - `.cadet/agent/core/` contains the shared Cadet-Agent framework documents.
9
9
  - `cadet-agent.md` is the thin global directive: identity, non-negotiable rules, workflow routing, hard-gate protocol, and skill dispatch.
10
- - `Harness.md` is the canonical harness contract: budgets, evidence-backed gates, retries, context tiers, tool routing, privacy, and escalation.
10
+ - `HarnessRuntime.md` is the lean runtime contract; `Harness.md` keeps the full harness rationale and reference.
11
11
  - `harness.schema.json` and `state.schema.json` are the machine-readable schemas for harness records and session state.
12
- - `skills/` contains scoped workflow-phase skills (PlanningReview, Requirements, Architecture, Spike, StoryBreakdown, TDD, Debugging, CodeReview, Resume, MCPSetup, AgentReviewer, Handoff, Reconciliation).
12
+ - `skills/` contains scoped workflow-phase skills (PlanningReview, Requirements, Architecture, DesignReview, Spike, StoryBreakdown, TDD, Debugging, CodeReview, VisualEvidence, Resume, MCPSetup, AgentReviewer, Handoff, Reconciliation).
13
13
  - `templates/` contains runtime templates for planning artifacts.
14
14
  - `.cadet/harness.json` holds repository-local budget/policy overrides (preserved by sync).
15
15
  - `.cadet/runs/` holds sanitized run ledgers (preserved by sync; no secrets or raw prompts by default).
16
- - `src/harness/` contains the dependency-free harness implementation (policy, budget, state, verification, context, routing, redaction, ledger, archive, hook).
16
+ - `src/harness/` contains the harness implementation (policy, budget, state, verification, context, routing, redaction, ledger, archive, hook, C# scan and diagram generation). Its one runtime dependency is `nomnoml`, the UML renderer used by `harness diagram` — see [Component diagrams](#component-diagrams).
17
17
  - `.cadet/agent/docs/` contains setup guides for each supported IDE.
18
18
  - `.github/agents/` contains the Copilot custom agent definitions (Cadet Agent + Cadet Agent Reviewer).
19
19
  - `.github/prompts/` contains Copilot slash-command skill prompts (`/cadet-review`, `/cadet-tdd`, etc.).
@@ -37,11 +37,13 @@ Cadet-Agent provides the **same skills** across six IDEs — one canonical file
37
37
  | Planning Review | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
38
38
  | Requirements | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
39
39
  | Architecture | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
40
+ | Design Review | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
40
41
  | Spike | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
41
42
  | Story Breakdown | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
42
43
  | TDD | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
43
44
  | Debugging | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
44
45
  | Code Review | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
46
+ | Visual Evidence | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
45
47
  | Resume | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
46
48
  | MCP Setup | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
47
49
  | Reconciliation | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
@@ -118,12 +120,12 @@ flowchart TD
118
120
  REPORT["Report current phase,<br/>epics, stories & gates"]
119
121
  CR["🔍 Context Resolution<br/>classify change size,<br/>calibrate learner,<br/>detect policy"]
120
122
  REQ["📋 Requirements<br/>Given/When/Then criteria<br/>assumption audit"]
121
- PLANREV["🧩 Planning Review<br/>interview one question<br/>at a time · decision tree"]
123
+ PLANREV["🧩 Planning Review (skill)<br/>interview one question<br/>at a time · decision tree"]
122
124
  ARCH["🏗️ Architecture<br/>technical design,<br/>ADR decisions"]
123
125
  SPIKE["🧪 Spikes<br/>resolve unverified<br/>assumptions"]
124
126
  BREAKDOWN["📐 Story Breakdown<br/>epics → testable stories"]
125
127
  IMPL["🔨 Implementation<br/>TDD per story,<br/>red → green → refactor"]
126
- REVIEW["✅ Review<br/>hard gate: 17-step<br/>code review, security"]
128
+ REVIEW["✅ Review<br/>hard gate: 23-step<br/>code review, security"]
127
129
  VALIDATE["✔️ Validation<br/>acceptance criteria,<br/>design artifact sync"]
128
130
  CLOSED(["🎉 Closed"])
129
131
  NEXT_STORY{"More stories<br/>in epic?"}
@@ -140,13 +142,13 @@ flowchart TD
140
142
 
141
143
  REQ --> ARCH
142
144
  ARCH -->|"unverified assumptions"| SPIKE
143
- ARCH -->|"all assumptions resolved"| BREAKDOWN
145
+ ARCH -->|"all assumptions resolved<br/>gate: designReviewCompleted ✅ (opt-in)"| BREAKDOWN
144
146
  SPIKE -->|"spike complete"| ARCH
145
147
 
146
148
  BREAKDOWN --> IMPL
147
149
 
148
150
  IMPL -->|"story complete"| REVIEW
149
- REVIEW -->|"gate: codeReviewCompleted ✅<br/>gate: securityReviewPassed ✅<br/>gate: reachabilityAddressed ✅ (opt-in)"| VALIDATE
151
+ REVIEW -->|"gate: codeReviewCompleted ✅<br/>gate: securityReviewPassed ✅<br/>gate: acceptanceCriteriaValidated ✅<br/>gate: reachabilityAddressed ✅ (opt-in)<br/>gate: userPlaythroughConfirmed ✅ (opt-in)"| VALIDATE
150
152
  VALIDATE -->|"gate: designArtifactSyncConfirmed ✅"| NEXT_STORY
151
153
  NEXT_STORY -->|"yes"| IMPL
152
154
  NEXT_STORY -->|"no"| CLOSED
@@ -161,17 +163,19 @@ flowchart TD
161
163
 
162
164
  ### Resuming a Session
163
165
 
164
- Use the `/cadet-resume` slash command to pick up where you left off. It reads `.cadet/state.json` and reports the current phase, epic/story progress, and outstanding gates — then dispatches the right skill for the next step. It also checks the current branch and working tree, so leftover changes from a previous task are resolved (commit, stash, push, or move to a new branch) before a new task begins. If no state file exists, it initializes a fresh session from `context-resolution`.
166
+ Use the `/cadet-resume` slash command to pick up where you left off. It runs `cadet-agent state brief`, the tier-0 summary of `.cadet/state.json`, and it checks the document with `cadet-agent state validate`. The brief prints the phase, the active work item, every gate with its newest evidence record, and the legal edge out of the current phase. A session therefore opens a bounded summary, not a record that grows with the project — the document also holds every work item ever closed and every change checkpoint ever recorded. It also checks the current branch and working tree, so leftover changes from a previous task are resolved (commit, stash, push, or move to a new branch) before a new task begins. If no state file exists, it initializes a fresh session from `context-resolution`.
165
167
 
166
168
  ### Phase Gating
167
169
 
168
- Hard gates are enforced at every phase transition. The agent reads `.cadet/state.json → gates` before advancing and **blocks** the transition if any required gate is `false`. Gates cannot be skipped without an explicit user-directed exception recorded in `changeHistory`.
170
+ Hard gates are enforced at every phase transition. The agent reads `.cadet/state.json → gates` before advancing and **blocks** the transition if any required gate is `false`. Gates cannot be skipped without an explicit, user-directed exception recorded in `.cadet/state.json → gateExceptions` — bounded by `expiresAt`, and naming the work items it covers. A `v1`–`v3` exception is read out of `changeHistory`, its older home.
169
171
 
170
172
  | Transition | Required Gates |
171
173
  |---|---|
172
174
  | architectureComplete → story-breakdown | `designReviewCompleted` when `designReview.enabled` is set — the formal design review, recorded by `harness verify-design-review` |
173
175
  | implementation → review | `testsPassed`, `compileCheckConfirmed`, `unityAnalyzerClean`, `storyTrackingUpdated`, and `architectureFitnessPassed` when the project declares architecture checks and enables them |
174
- | review → validation | `codeReviewCompleted`, `securityReviewPassed`, `acceptanceCriteriaValidated`, and `reachabilityAddressed` when `reachability.enabled` is set |
176
+ | review → validation | `codeReviewCompleted`, `securityReviewPassed`, `acceptanceCriteriaValidated`, `reachabilityAddressed` when `reachability.enabled` is set, and `userPlaythroughConfirmed` when `userPlay.enabled` is set — a story declares `Play: required — <what the user does and what they see>` or `Play: deferred to <work item> — <why>`. A person's own answer satisfies `required` (ask them, then `harness confirm --gate userPlaythroughConfirmed --reason "<their answer>"`); `harness verify-play` records `deferred`, and the deferral expires when the named work item closes |
177
+ | validation → closed | `designArtifactSyncConfirmed`, and `humanAcceptanceConfirmed` when `humanAcceptance.enabled` is set — a person's own answer, recorded with `harness confirm --gate humanAcceptanceConfirmed --reason "<their answer>"`; no command can produce it |
178
+
175
179
  ### Runtime context protocol (opt-in, and the framework's own claim discipline)
176
180
 
177
181
  `harness context plan` states what a phase requires (with a reason and a hash for each reference),
@@ -181,42 +185,71 @@ reported as it is — a run reported as `recorded` is never reported as `enforce
181
185
  a hook that declares it enforces context. A required reference that was never loaded, or that changed
182
186
  after the record, blocks the checkpoint. See `.cadet/agent/core/Harness.md` §2d.
183
187
 
184
- | validation → closed | `designArtifactSyncConfirmed`, and `humanAcceptanceConfirmed` when `humanAcceptance.enabled` is set — a person's own record (`harness acceptance-form` writes the form, `harness confirm --artifact` records it); no command can produce it |
185
-
186
188
  **`closed` is end-of-epic, not per-story.** `validation → closed` is taken only when no stories remain (`NEXT_STORY → no → CLOSED` above). When an epic still has stories, the next story re-enters from `validation → implementation` (`NEXT_STORY → yes → IMPL`). Do not close a story individually: `closed` is terminal, and there is no transition out of it.
187
189
 
188
- The full set of legal transitions is the three gated rows above **plus** the ungated forward edges (classification, planning progression, `story-breakdown → implementation`, and the `validation → implementation` next-story loop). Any transition outside that set is rejected with a named reason.
190
+ The full set of legal transitions is the three gated rows above **plus** the ungated forward edges (classification, planning progression, `story-breakdown → implementation`, and the `validation → implementation` next-story loop). Any transition outside that set is rejected with a named reason. **Planning Review is a skill, not a phase**: the agent dispatches it before requirements or architecture when the plan is fuzzy or contested, and it records no transition.
191
+
192
+ ### The response contract
193
+
194
+ The framework's only per-reply output is one line: `cadet-agent: ok`, or the problem in its place. `cadet-agent harness status` derives that line — read-only — from the state document and the run ledger, so it cannot claim a health nothing verified. `ok` means the record is readable, valid and fresh, and no recorded run stopped on a budget or failed to run. A gate that is unmet because the story is unfinished is normal, and is not reported.
195
+
196
+ The rest of a reply carries the work, in Simplified Technical English (ASD-STE100). What it must carry is set by **what it reports**, not by the phase: a change to the software — lead with what the software now does that it did not before, in the product's own terms; a change to a plan artifact — what the plan now says, the decisions taken, the alternatives rejected and why; a measurement or an investigation — the question, the number, and what it does not settle; a review verdict — met, not met, or met in part; or nothing new — the answer, then the reasoning, then what it depends on. A reply that changed the repository also carries three **invariants**, whichever subject it leads with: **files** — one line per changed file, path first, taken from `cadet-agent harness changes` rather than from memory; **checks** — red before green, compile, analyzer, verdict; and **owed** — what is unverified, deferred, or waiting on the reader. The file list is the reply's only list, and it is required: it is how the reader finds the change in his IDE. A record id never appears alone — `AC-65 (the match-end banner — the world stops and the player is told)`.
189
197
 
190
198
  ### Harness
191
199
 
192
200
  Gates are backed by **evidence**, not assertion. Each claimed gate must have a fresh, non-superseded evidence record bound to the current work item, input tree hash, and acceptance criteria. The harness also bounds context, tokens, tool calls, retries, wall-clock time, cost, and archive sizes — and those bounds are enforced, not advisory.
193
201
 
194
- - Rules: `.cadet/agent/core/Harness.md`. Data contract: `docs/core/HarnessContract.md`.
202
+ - Runtime rules: `.cadet/agent/core/HarnessRuntime.md`. Full contract: `.cadet/agent/core/Harness.md`. Data contract: `docs/core/HarnessContract.md`.
195
203
  - Overrides: `.cadet/harness.json` (preserved by sync; conservative defaults in `src/harness/policy.mjs`).
196
204
  - Ledgers: `.cadet/runs/<runId>.json` (sanitized; artifacts are redacted before they are written; no secrets or raw prompts by default).
197
205
  - Transitions recompute the input tree hash from the evidence's relevant files, so editing a relevant file invalidates the evidence.
198
206
  - `harness verify` binds evidence to `--files` (or the working tree's changed files), and a `testsPassed` green result requires a prior red record.
207
+ - A `--files` binding may not name a path the recording command itself writes: `--files .cadet/state.json` is refused before anything runs, because the write that follows would stale the record it just wrote.
199
208
  - When Git is unavailable and no `--files` are given, verification blocks (`freshness-unavailable`) rather than recording unscoped evidence.
200
209
  - `state validate` rejects a `true` gate whose evidence is missing, stale, expired, superseded, or bound to another work item; evidence records are schema-validated in full (`command`, `result`, `criteriaHash`, and a freshness bound).
210
+ - `state validate` errors when a work item that a `storyCompletions` row records as finished, with evidence behind it, still reads `planned`. The remedy is `done` or `superseded`: a finished story must not be indistinguishable from one that was never started.
211
+ - A `changeHistory` entry is a pointer, not a retelling: it is limited to 400 characters, and `state compact` archives a longer entry in place rather than truncating it.
201
212
  - Evidence must include a UUID, work item, phase, gate, status, command/result, input-tree hash, criteria hash, relevant files, timestamp, and either `expiresAt` or `freshnessPolicy`.
202
213
  - **Evidence history does not live in `state.json`.** A v4 document keeps only the active work item's records inline; a closed work item's evidence is written into the commit that closes it, as `Cadet-*` trailers, and archived to `.cadet/archive/`. `evidenceCoverage` indexes what left, so the "a done story owns evidence" check still works offline. Cadet still never commits: `state seal` prepares a message file and you commit with `git commit -F`.
214
+ - **Tier 0 loads the state brief, not the state document.** `cadet-agent state brief` prints the phase, the active work item with its story and epic status, every gate with its newest evidence record, and what compaction would archive; `harness context plan` writes it to `.cadet/context/state-brief.md` and names it at tier 0, hashed like any other required reference. The document is not the current story — it also holds every work item ever closed and every change checkpoint ever recorded, so it grows with the project and never shrinks. On a real consumer it reached 94,547 B, about 31,500 tokens, of which the current story was 31%; the brief for that same document was 1,745 B.
215
+ - **Two gates are human-owned: `humanAcceptanceConfirmed` and `userPlaythroughConfirmed`.** No
216
+ command can produce them, and `--command` is refused for them. ASK the person — for a playthrough,
217
+ whether they played it and what was unexpected; for an acceptance, whether they accept the work and
218
+ what they saw — and record their own answer with `harness confirm --gate <gate> --reason "<what they
219
+ said>"`. There is no form: the record is the person's sentence, and a record with no answer in it is
220
+ refused when it is written and again when the state is validated.
203
221
  - Command output counts against the output budget; a configured cost budget cannot be satisfied by unmeasurable cost (the run is blocked, `budget-blocked`).
204
222
  - State and run ledgers are written atomically, so an interrupted write cannot truncate a record; persisted artifacts are redacted before hashing or writing.
205
223
  - Empty freshness coverage is an explicit policy decision: set `allowEmptyFreshness: true` in `.cadet/harness.json` only when unscoped evidence is acceptable.
206
224
 
207
225
  ```bash
226
+ cadet-agent state init --workflow-path large # write the first state document (validated before it lands)
208
227
  cadet-agent state validate # validate state against the schema (read-only)
209
228
  cadet-agent state validate --verify-sealed # also read evidence out of commit trailers
210
229
  cadet-agent state migrate # atomically upgrade v1 → the current version
211
230
  cadet-agent state migrate --to 4 # archive closed work items' evidence; build the index
212
231
  cadet-agent state compact --keep active # routine housekeeping on a v4 state
213
232
  cadet-agent state seal # write the active work item's evidence as commit trailers
233
+ cadet-agent state begin --epic <id> --story <id> # start a work item; archive the previous item's evidence
214
234
  cadet-agent state transition --to review # enforce the matrix + evidence
235
+ cadet-agent harness status # the health line: ok, or the problem (read-only)
215
236
  cadet-agent harness verify --gate testsPassed --files src/a.cs # bounded, classified loop
237
+ cadet-agent harness verify-acs --story <path> # derive coverage from the run report, then record the gate
238
+ cadet-agent harness verify-reachability --story <path> # check the declaration; run the project probe
239
+ cadet-agent harness verify-design-review --artifact <path> --files <design,requirements,ADRs>
240
+ cadet-agent harness verify-architecture # run the project's declared fitness checks
241
+ cadet-agent harness verify-play --story <path> # check a story's `Play:` declaration; record a deferral
242
+ cadet-agent harness confirm --gate <gate> --reason "<answer>" # record a person's own answer
243
+ cadet-agent harness changes # the files a story changed, with links (read-only)
216
244
  cadet-agent harness report # budget consumption and failures (no secrets)
217
245
  cadet-agent harness reconcile # reconcile the planning chain against state.json (read-only)
246
+ cadet-agent harness matrix-check # reconcile a TDD matrix against the test inventory (read-only)
247
+ cadet-agent harness context plan|record|validate # plan what a phase loads, record what it loaded, decide
218
248
  cadet-agent harness cleanup --older-than-ms <n> # apply the retention policy (bound required)
219
249
  cadet-agent harness capabilities # available CLI/Unity/MCP/hook/token/cost telemetry
250
+ cadet-agent harness capabilities --verify-host # probe the configured interception, per action
251
+ cadet-agent harness diagram # render UML component diagrams per package, coloured by progress
252
+ cadet-agent harness verify-diagrams # check the committed diagram tree is current (read-only)
220
253
  ```
221
254
 
222
255
  Every command supports `--format human|json` and exits nonzero for invalid state, failed verification, budget exhaustion, stale evidence, or safety rejection.
@@ -237,6 +270,30 @@ cadet-agent harness record --dry-run # reports what it would write,
237
270
 
238
271
  See `docs/guidance/HarnessTroubleshooting.md` for stale evidence, budget exhaustion, unavailable Unity CLI, and live MCP connection failures.
239
272
 
273
+ ## Component diagrams
274
+
275
+ `cadet-agent harness diagram` renders the C# structure as UML component diagrams — one per (package × epic) — and colours every component by how far its work has progressed: **red** not started, **amber** in progress, **green** done.
276
+
277
+ The picture is the record, not a separate map to maintain. Progress is read from `.cadet/state.json` and the evidence archive, joined to the files each story's evidence bound (`relevantFiles`).
278
+
279
+ - **Packages** come from Unity `.asmdef` assembly definitions and their `references`, falling back to top-level folders when a tree has none. Unity test assemblies are left out by default; pass `--include-tests` to keep them.
280
+ - **Components** are the namespaces inside a package.
281
+ - **Scope** is the components the epic touched, plus their one-hop dependencies; anything else is reported as an elided count, so a package stays readable however large it grows.
282
+ - **Colour is cumulative.** A component shows its progress across *all* epics, so a component finished by one epic is green in every diagram, not only the one that finished it.
283
+ - **Drill down.** Click any component box to open that component's page: the files it owns (linked to source), the types it declares, what it depends on and is used by, and the stories that touched it.
284
+
285
+ The generator writes a self-contained tree under `.cadet/diagrams/`: an `index.html` at the root, an `index.html` per package, a page per component, and a `.noml` (the UML source — the portable, testable artifact) plus a `.svg` per (package × epic). Open `.cadet/diagrams/index.html` to navigate. Rendering is done by [nomnoml](https://github.com/skanaar/nomnoml) (MIT), the CLI's only runtime dependency; no browser, Java, or CDN is involved.
286
+
287
+ ```bash
288
+ cadet-agent harness diagram # default output: .cadet/diagrams
289
+ cadet-agent harness diagram --package Cadet.Core # one package only
290
+ cadet-agent harness diagram --include-tests # keep Unity test assemblies
291
+ cadet-agent harness diagram --out ./docs/diagrams # somewhere else
292
+ cadet-agent harness verify-diagrams # is the committed tree still current?
293
+ ```
294
+
295
+ The tree is **committed** and is part of closure: the CodeReview skill regenerates it once the story and epic records are updated, and `harness reconcile` reports a blocking `diagram-drift` finding when it no longer matches — which is what `designArtifactSyncConfirmed` refuses closure on. `harness verify-diagrams` is the read-only check for CI.
296
+
240
297
  ## Examples
241
298
 
242
299
  ### GitHub Copilot
@@ -332,13 +389,14 @@ If a specific game repository needs local conventions, add a policy file under `
332
389
 
333
390
  ## Package Output
334
391
  Running `./package-agent.ps1` produces `cadet-agent.zip` with this layout:
335
- - `.cadet/agent/core/` (including `Harness.md`, `harness.schema.json`, and `state.schema.json`)
392
+ - `.cadet/agent/core/` (including `HarnessRuntime.md`, `Harness.md`, `harness.schema.json`, and `state.schema.json`)
336
393
  - `.cadet/agent/core/skills/`
337
394
  - `.cadet/agent/core/templates/`
338
395
  - `.github/agents/cadet.agent.md`
339
396
  - `.github/agents/cadet-agent-reviewer.agent.md`
340
397
  - `.github/prompts/cadet-*.prompt.md`
341
- - `.github/hooks/`
398
+ - `.github/hooks/` (the Copilot `git-guard` hook and its scripts)
399
+ - `.githooks/pre-commit` (the portable Git hook; installed by you with `git config core.hooksPath .githooks`)
342
400
  - `.cursor/rules/cadet-agent.md`
343
401
  - `.cursor/rules/cadet-agent-reviewer.md`
344
402
  - `.continue/rules/cadet-agent.md`
@@ -346,6 +404,10 @@ Running `./package-agent.ps1` produces `cadet-agent.zip` with this layout:
346
404
  - `.continue/config.yaml`
347
405
  - `.claude/skills/cadet-agent/SKILL.md`
348
406
  - `.claude/skills/cadet-*/SKILL.md`
407
+ - `.agents/skills/cadet-agent/SKILL.md` (the cross-client root Deep Code and Hermes read)
408
+ - `.agents/skills/cadet-*/SKILL.md`
409
+ - `AGENTS.md` (create-only: an existing consumer copy is never overwritten)
410
+ - `.cadet/harness.json` (create-only: the new-consumer policy seed)
349
411
 
350
412
  ## Notes
351
413
  - `.cadet/agent/core/FrameworkManifest.json` defines the managed and preserved paths for packaged installs.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cadet-agent",
3
- "version": "0.56.0",
3
+ "version": "0.63.1",
4
4
  "description": "Cross-IDE agent framework for Unity/C# game-development — one-command install",
5
5
  "type": "module",
6
6
  "bin": {
@@ -33,5 +33,8 @@
33
33
  "homepage": "https://github.com/naishtech/cadet-agent#readme",
34
34
  "engines": {
35
35
  "node": ">=18.0.0"
36
+ },
37
+ "dependencies": {
38
+ "nomnoml": "^1.7.0"
36
39
  }
37
40
  }