@cleocode/skills 2026.5.83 → 2026.5.86
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/package.json +1 -1
- package/skills/_shared/__tests__/lifecycle-protocol-reconcile.test.ts +112 -0
- package/skills/_shared/__tests__/loom-adr-links.test.ts +163 -0
- package/skills/_shared/__tests__/loom-stage-coverage.test.ts +167 -0
- package/skills/ct-adr-recorder/SKILL.md +92 -0
- package/skills/ct-adr-recorder/__tests__/skill-adr-recorder.test.ts +65 -0
- package/skills/ct-consensus-voter/SKILL.md +14 -0
- package/skills/ct-contribution/SKILL.md +80 -0
- package/skills/ct-docs-lookup/SKILL.md +116 -1
- package/skills/ct-docs-lookup/references/ctx7-workflow.md +198 -0
- package/skills/ct-docs-lookup/references/library-id-resolution.md +217 -0
- package/skills/ct-docs-lookup/references/version-specific-docs.md +220 -0
- package/skills/ct-docs-review/SKILL.md +133 -1
- package/skills/ct-docs-review/__tests__/skill-docs-review.test.ts +53 -0
- package/skills/ct-docs-review/references/inline-comment-patterns.md +268 -0
- package/skills/ct-docs-review/references/pr-review-mode.md +270 -0
- package/skills/ct-docs-review/references/style-violations.md +341 -0
- package/skills/ct-docs-write/SKILL.md +157 -1
- package/skills/ct-docs-write/__tests__/skill-docs-write.test.ts +55 -0
- package/skills/ct-docs-write/references/audience-targeting.md +305 -0
- package/skills/ct-docs-write/references/cleo-style-guide.md +234 -0
- package/skills/ct-docs-write/references/markdown-patterns.md +329 -0
- package/skills/ct-documentor/SKILL.md +11 -0
- package/skills/ct-documentor/references/anti-patterns.md +216 -0
- package/skills/ct-documentor/references/chain-orchestration.md +194 -0
- package/skills/ct-documentor/references/doc-types-and-templates.md +301 -0
- package/skills/ct-documentor/references/style-coordination.md +195 -0
- package/skills/ct-epic-architect/SKILL.md +15 -0
- package/skills/ct-ivt-looper/SKILL.md +32 -0
- package/skills/ct-release-orchestrator/SKILL.md +16 -0
- package/skills/ct-research-agent/SKILL.md +24 -0
- package/skills/ct-research-agent/references/anti-patterns.md +154 -0
- package/skills/ct-research-agent/references/citation-and-evidence.md +140 -0
- package/skills/ct-research-agent/references/source-strategy.md +116 -0
- package/skills/ct-research-agent/references/triggers-and-routing.md +93 -0
- package/skills/ct-skill-validator/SKILL.md +19 -0
- package/skills/ct-skill-validator/scripts/check_depth.py +306 -0
- package/skills/ct-spec-writer/SKILL.md +86 -1
- package/skills/ct-spec-writer/__tests__/skill-spec-writer.test.ts +60 -0
- package/skills/ct-spec-writer/references/anti-patterns.md +176 -0
- package/skills/ct-spec-writer/references/rfc2119-language.md +138 -0
- package/skills/ct-spec-writer/references/spec-templates.md +233 -0
- package/skills/ct-spec-writer/references/traceability-matrix.md +145 -0
- package/skills/ct-task-executor/SKILL.md +25 -0
- package/skills/ct-task-executor/references/acceptance-criteria-mapping.md +163 -0
- package/skills/ct-task-executor/references/anti-patterns.md +201 -0
- package/skills/ct-task-executor/references/common-failures.md +193 -0
- package/skills/ct-task-executor/references/evidence-and-gates.md +179 -0
- package/skills/ct-task-executor/references/implementation-patterns.md +160 -0
- package/skills/ct-validator/SKILL.md +44 -0
- package/skills/ct-validator/references/anti-patterns.md +194 -0
- package/skills/ct-validator/references/compliance-reports.md +199 -0
- package/skills/ct-validator/references/schema-checking.md +191 -0
- package/skills/ct-validator/references/validation-modes.md +185 -0
- package/skills/manifest.json +82 -16
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# Common Failures
|
|
2
|
+
|
|
3
|
+
The most frequent worker-agent failure modes observed across CLEO
|
|
4
|
+
sessions. Each entry includes a recognition signal, the root cause, and
|
|
5
|
+
the corrected approach. Many of these are recorded in BRAIN observations
|
|
6
|
+
under `O-*` IDs.
|
|
7
|
+
|
|
8
|
+
## False Success Reports
|
|
9
|
+
|
|
10
|
+
**Symptom.** Worker returns "Task complete. All tests pass." The
|
|
11
|
+
orchestrator later finds (via `cleo show <id>` showing pending gates,
|
|
12
|
+
or `git log` showing no commits, or `pnpm test` showing failures) that
|
|
13
|
+
the work was not actually done.
|
|
14
|
+
|
|
15
|
+
**Recognition.** Reported success without (a) a commit SHA in the
|
|
16
|
+
response, (b) the test output excerpt, or (c) a `cleo verify` audit
|
|
17
|
+
trail.
|
|
18
|
+
|
|
19
|
+
**Root cause.** The worker conflated "I drafted code that should work"
|
|
20
|
+
with "I ran the tests and they passed." Often correlates with model
|
|
21
|
+
fatigue at >70% context utilization.
|
|
22
|
+
|
|
23
|
+
**Fix.** The worker MUST run the full quality-gate sequence (biome →
|
|
24
|
+
build → typecheck → test) and capture the exit codes / output before
|
|
25
|
+
reporting completion. The spawn prompt's tier-1+ injection contains this
|
|
26
|
+
ritual — re-read it if uncertain.
|
|
27
|
+
|
|
28
|
+
This failure mode was first formally documented in T1450 PROOF
|
|
29
|
+
(`spawn-capability-gap-2026-04-25.md` — historical context, the
|
|
30
|
+
underlying gap is now resolved but the pattern recurs at the worker
|
|
31
|
+
level).
|
|
32
|
+
|
|
33
|
+
## Outside-Worktree Edits
|
|
34
|
+
|
|
35
|
+
**Symptom.** Worker edits files outside its assigned worktree path. The
|
|
36
|
+
git shim usually blocks this, but if it slips through, the change does
|
|
37
|
+
not get into the PR.
|
|
38
|
+
|
|
39
|
+
**Recognition.** Files appear modified in `/mnt/projects/cleocode/` but
|
|
40
|
+
not in the worktree's branch.
|
|
41
|
+
|
|
42
|
+
**Root cause.** Worker resolved a relative path against the wrong cwd
|
|
43
|
+
(persistent shell state was not reset between tool calls), or
|
|
44
|
+
deliberately followed an absolute path from a prior session's notes.
|
|
45
|
+
|
|
46
|
+
**Fix.** The spawn prompt's `FIRST ACTION: cd <path>` MUST be the first
|
|
47
|
+
command. All subsequent paths SHOULD be absolute within the worktree.
|
|
48
|
+
If unsure, prefix with `git rev-parse --show-toplevel` first.
|
|
49
|
+
|
|
50
|
+
## Cherry-Pick Instead of Merge
|
|
51
|
+
|
|
52
|
+
**Symptom.** When integrating completed work to main, the worker (or
|
|
53
|
+
overzealous orchestrator) used `git cherry-pick` instead of
|
|
54
|
+
`git merge --no-ff`.
|
|
55
|
+
|
|
56
|
+
**Recognition.** `git log --grep "<task-id>"` shows different SHAs in
|
|
57
|
+
the task branch vs main. The author email is lost. `cleo find` cannot
|
|
58
|
+
relate commits to the task.
|
|
59
|
+
|
|
60
|
+
**Root cause.** Following a generalized "cherry-pick is safer" instinct
|
|
61
|
+
without reading ADR-062. The CLEO contract is that workers commit on
|
|
62
|
+
their task branch; the integrator MUST use `git merge --no-ff
|
|
63
|
+
task/<id>` to preserve SHAs, author identity, and the
|
|
64
|
+
`cleo find <task-id> --commits` trace.
|
|
65
|
+
|
|
66
|
+
**Fix.** Always `git merge --no-ff task/<TID>` for integration. See
|
|
67
|
+
`feedback_cherry_pick_worktrees.md` for the full pattern.
|
|
68
|
+
|
|
69
|
+
## Hard Reset Disasters
|
|
70
|
+
|
|
71
|
+
**Symptom.** Multiple worktree-spawn agents working in parallel suddenly
|
|
72
|
+
find their work has vanished from main. The orchestrator's primary
|
|
73
|
+
working dir's branch is on main; an agent or the orchestrator ran
|
|
74
|
+
`git reset --hard origin/main`, wiping local commits that had not yet
|
|
75
|
+
been pushed.
|
|
76
|
+
|
|
77
|
+
**Recognition.** `git reflog` on the primary working dir shows a
|
|
78
|
+
recent `HEAD@{N}: reset: moving to origin/main`.
|
|
79
|
+
|
|
80
|
+
**Root cause.** The primary working dir's branch is shared across
|
|
81
|
+
parallel orchestrators. A reset there wipes shared state. Caught in
|
|
82
|
+
T9354 session and recovered via reflog cherry-pick — at the cost of 3
|
|
83
|
+
PRs.
|
|
84
|
+
|
|
85
|
+
**Fix.** NEVER `git reset --hard` on the orchestrator's primary working
|
|
86
|
+
dir while any worker agents are alive. Apply fixes from inside the
|
|
87
|
+
worker's worktree path, or use `git update-ref` + push to land
|
|
88
|
+
corrections without resetting the local branch.
|
|
89
|
+
|
|
90
|
+
## ESM Import Path Drift
|
|
91
|
+
|
|
92
|
+
**Symptom.** Build fails locally with `ERR_MODULE_NOT_FOUND` or CI fails
|
|
93
|
+
with `Cannot find module './foo'` even though the file exists.
|
|
94
|
+
|
|
95
|
+
**Recognition.** Import line `import { foo } from "./foo";` (no
|
|
96
|
+
`.js` extension).
|
|
97
|
+
|
|
98
|
+
**Root cause.** The repo's TypeScript config uses pure ESM with explicit
|
|
99
|
+
`.js` extensions on imports. Stripping the extension works at write
|
|
100
|
+
time but fails at runtime under Node's strict ESM resolver.
|
|
101
|
+
|
|
102
|
+
**Fix.** Always include `.js` in relative imports — even for `.ts`
|
|
103
|
+
sources. The compiled output uses the same extension. Workspace imports
|
|
104
|
+
(`@cleocode/...`) do not need the extension.
|
|
105
|
+
|
|
106
|
+
## Cross-Package Reach
|
|
107
|
+
|
|
108
|
+
**Symptom.** Worker imports across package boundaries without declaring
|
|
109
|
+
the dependency in the consumer's `package.json`. Build succeeds locally
|
|
110
|
+
(pnpm hoists) but CI fails on a clean install.
|
|
111
|
+
|
|
112
|
+
**Recognition.** Import like `import { thing } from "../../core/src/foo.js"`
|
|
113
|
+
inside `packages/cleo/`.
|
|
114
|
+
|
|
115
|
+
**Root cause.** Took a relative-path shortcut instead of using the
|
|
116
|
+
workspace import `@cleocode/core`. Also bypasses the type contract.
|
|
117
|
+
|
|
118
|
+
**Fix.** Add the consumer's `package.json` dependency and use the
|
|
119
|
+
workspace import:
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
import { thing } from "@cleocode/core/foo";
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
If the function being imported is not exported from the consumer
|
|
126
|
+
package, add an export — do not reach through internals.
|
|
127
|
+
|
|
128
|
+
## Type Cast Chains
|
|
129
|
+
|
|
130
|
+
**Symptom.** Code contains `as unknown as SomeType`, `any` types, or
|
|
131
|
+
empty `catch (err: unknown)` blocks. AGENTS.md type-safety rules ban
|
|
132
|
+
all three.
|
|
133
|
+
|
|
134
|
+
**Recognition.** `pnpm biome check` warnings on `any` / `unknown` usage,
|
|
135
|
+
or grep for `as unknown as`.
|
|
136
|
+
|
|
137
|
+
**Root cause.** Worker hit a type mismatch and reached for the escape
|
|
138
|
+
hatch instead of fixing the underlying contract.
|
|
139
|
+
|
|
140
|
+
**Fix.** Inspect the actual types; update or extend the contract in
|
|
141
|
+
`packages/contracts/src/` if necessary. The repo's policy is "find the
|
|
142
|
+
root cause" — type casts hide the cause and accumulate as debt.
|
|
143
|
+
|
|
144
|
+
## Drive-By Refactors
|
|
145
|
+
|
|
146
|
+
**Symptom.** PR for T9660 includes unrelated changes to files outside
|
|
147
|
+
the task's scope. Reviewer comments "scope creep" and requests a split.
|
|
148
|
+
|
|
149
|
+
**Recognition.** `git diff --stat HEAD` shows files modified that do
|
|
150
|
+
not appear in the task's acceptance criteria.
|
|
151
|
+
|
|
152
|
+
**Root cause.** Worker noticed something to improve while reading
|
|
153
|
+
adjacent code and "fixed it in passing".
|
|
154
|
+
|
|
155
|
+
**Fix.** Revert unrelated changes; file a new task for them. One task =
|
|
156
|
+
one purpose = one PR. The CLEO contract relies on this for traceability.
|
|
157
|
+
|
|
158
|
+
## Stale Cache Confusion
|
|
159
|
+
|
|
160
|
+
**Symptom.** `cleo complete` fails with `E_EVIDENCE_STALE` even though
|
|
161
|
+
the worker is sure they didn't touch the file after verify.
|
|
162
|
+
|
|
163
|
+
**Recognition.** Error message references a file the worker only read,
|
|
164
|
+
never edited.
|
|
165
|
+
|
|
166
|
+
**Root cause.** A formatter (biome auto-fix on save, or a sibling
|
|
167
|
+
agent's commit) modified the file between `cleo verify` and
|
|
168
|
+
`cleo complete`. The sha256 no longer matches.
|
|
169
|
+
|
|
170
|
+
**Fix.** Re-run `cleo verify` for the affected gate(s) before
|
|
171
|
+
`cleo complete`. Treat verify+complete as an atomic pair — minimize the
|
|
172
|
+
time between them.
|
|
173
|
+
|
|
174
|
+
## Forgotten Memory Observation
|
|
175
|
+
|
|
176
|
+
**Symptom.** Task completed; the session ends; the next session
|
|
177
|
+
re-discovers a fact that should have been retained.
|
|
178
|
+
|
|
179
|
+
**Recognition.** `cleo memory find <topic>` after the task returns
|
|
180
|
+
nothing, even though the worker learned something non-trivial.
|
|
181
|
+
|
|
182
|
+
**Root cause.** Worker skipped the post-complete `cleo memory observe`
|
|
183
|
+
step (CLEO-INJECTION.md trigger row 2: "after non-trivial task
|
|
184
|
+
completion").
|
|
185
|
+
|
|
186
|
+
**Fix.** After every non-trivial `cleo complete`, run:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
cleo memory observe "<one-paragraph learning>" --title "<short title>"
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Trivial tasks (typo fix, version bump) do not need observations.
|
|
193
|
+
Anything that changed your mental model does.
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# Evidence and Gates
|
|
2
|
+
|
|
3
|
+
ADR-051 requires every `cleo complete <TASK_ID>` to be backed by
|
|
4
|
+
programmatic evidence. The executor MUST attach evidence atoms to each
|
|
5
|
+
gate before completing; the verify step re-validates them against git,
|
|
6
|
+
the filesystem, and the toolchain. This reference defines atom shapes,
|
|
7
|
+
canonical names, and the failure modes most often hit.
|
|
8
|
+
|
|
9
|
+
## The Gate Set
|
|
10
|
+
|
|
11
|
+
Every task carries six standard gates. Optional gates may be added per
|
|
12
|
+
task; the standard set is non-negotiable.
|
|
13
|
+
|
|
14
|
+
| Gate | Meaning | Evidence kind |
|
|
15
|
+
|------|---------|---------------|
|
|
16
|
+
| implemented | Code change exists | `commit:<sha>` + `files:<list>` |
|
|
17
|
+
| testsPassed | Tests green | `tool:test` or `test-run:<json>` |
|
|
18
|
+
| qaPassed | Lint + typecheck clean | `tool:lint` + `tool:typecheck` |
|
|
19
|
+
| documented | Docs updated | `files:<docs-paths>` |
|
|
20
|
+
| securityPassed | Security scan or waiver | `tool:security-scan` or `note:<rationale>` |
|
|
21
|
+
| cleanupDone | Branch/cleanup summary | `note:<text>` |
|
|
22
|
+
|
|
23
|
+
Decision-only tasks (no code change; the deliverable is a recorded BRAIN
|
|
24
|
+
decision) use a distinct `implemented` atom shape:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
cleo verify T### --gate implemented \
|
|
28
|
+
--evidence "decision:D-arch-001;files:docs/research-note.md"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
This shape eliminates the `CLEO_OWNER_OVERRIDE` path on decision-only
|
|
32
|
+
completion (per T1875).
|
|
33
|
+
|
|
34
|
+
## Atom Kinds
|
|
35
|
+
|
|
36
|
+
### `commit:<sha>`
|
|
37
|
+
|
|
38
|
+
The git commit SHA where the work landed. Re-validated for reachability
|
|
39
|
+
from HEAD at complete time. The SHA MUST be a full or short SHA that
|
|
40
|
+
`git rev-parse` resolves.
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
cleo verify T### --gate implemented \
|
|
44
|
+
--evidence "commit:b8e723d78;files:packages/skills/.../references/triggers.md"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
If the worktree's branch has been merged to main since the commit, the
|
|
48
|
+
atom still resolves. If the commit was rebased away, validation fails
|
|
49
|
+
with `E_EVIDENCE_STALE` — re-attach the new SHA.
|
|
50
|
+
|
|
51
|
+
### `files:<comma-list>`
|
|
52
|
+
|
|
53
|
+
Paths affected by the work. Re-validated by sha256 against the on-disk
|
|
54
|
+
file at complete time. If the file's contents change between verify
|
|
55
|
+
and complete (e.g. a later edit drifts the hash), validation fails with
|
|
56
|
+
`E_EVIDENCE_STALE`.
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
--evidence "files:packages/cleo/src/commands/release-plan.ts,packages/cleo/__tests__/release-plan.test.ts"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Use forward slashes; absolute or repo-relative paths both work.
|
|
63
|
+
|
|
64
|
+
### `tool:<name>`
|
|
65
|
+
|
|
66
|
+
Canonical tool name. CLEO resolves to the project's actual command via
|
|
67
|
+
`.cleo/project-context.json` (`testing.command`, `build.command`) with
|
|
68
|
+
per-`primaryType` fallbacks. Canonical names:
|
|
69
|
+
|
|
70
|
+
| Canonical | Resolves to (Node) | Fallback |
|
|
71
|
+
|-----------|-------------------|----------|
|
|
72
|
+
| `test` | `pnpm run test` | `cargo test`, `pytest`, `go test` |
|
|
73
|
+
| `build` | `pnpm run build` | `cargo build`, etc. |
|
|
74
|
+
| `lint` | biome / eslint | clippy, ruff |
|
|
75
|
+
| `typecheck` | `tsc -b` | mypy |
|
|
76
|
+
| `audit` | `pnpm audit` | `cargo audit` |
|
|
77
|
+
| `security-scan` | varies | varies |
|
|
78
|
+
|
|
79
|
+
Legacy aliases still work: `pnpm-test`, `tsc`, `biome`, `cargo-test`,
|
|
80
|
+
`pytest` all map to canonical names.
|
|
81
|
+
|
|
82
|
+
### `test-run:<json-path>`
|
|
83
|
+
|
|
84
|
+
Path to a vitest JSON output file. Re-validated by hash. Preferred for
|
|
85
|
+
sharing test evidence across sibling tasks in the same wave.
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
pnpm vitest run --reporter=json --outputFile=/tmp/vitest-out.json
|
|
89
|
+
cleo verify T### --gate testsPassed --evidence "test-run:/tmp/vitest-out.json"
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### `decision:<decision-id>`
|
|
93
|
+
|
|
94
|
+
A BRAIN decision ID (e.g., `D-arch-001`) or an `AGT-*` provenance ID.
|
|
95
|
+
Validated by lookup against the brain.db; status MUST be `proposed` or
|
|
96
|
+
`accepted`. Used for decision-only tasks where the deliverable is the
|
|
97
|
+
decision itself, not code.
|
|
98
|
+
|
|
99
|
+
### `note:<text>`
|
|
100
|
+
|
|
101
|
+
Free-form rationale. Always permitted; used when no programmatic atom
|
|
102
|
+
applies. Notes appear in the audit log but do not gate validation —
|
|
103
|
+
they document, they do not prove. Reserve for `cleanupDone`,
|
|
104
|
+
`securityPassed` waivers, and rare edge cases.
|
|
105
|
+
|
|
106
|
+
## The Ritual
|
|
107
|
+
|
|
108
|
+
The full per-task ritual, in order:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# 1. Implement and verify locally
|
|
112
|
+
pnpm biome check --write .
|
|
113
|
+
pnpm run build && pnpm run typecheck
|
|
114
|
+
pnpm run test
|
|
115
|
+
git add -p && git commit -m "feat(T###): <slug>"
|
|
116
|
+
|
|
117
|
+
# 2. Capture evidence for each gate (commit SHA from step 1)
|
|
118
|
+
SHA=$(git rev-parse HEAD)
|
|
119
|
+
FILES=$(git diff-tree --no-commit-id --name-only -r HEAD | paste -sd,)
|
|
120
|
+
|
|
121
|
+
cleo verify T### --gate implemented --evidence "commit:$SHA;files:$FILES"
|
|
122
|
+
cleo verify T### --gate testsPassed --evidence "tool:test"
|
|
123
|
+
cleo verify T### --gate qaPassed --evidence "tool:lint;tool:typecheck"
|
|
124
|
+
cleo verify T### --gate documented --evidence "files:docs/path/to/note.md"
|
|
125
|
+
cleo verify T### --gate securityPassed --evidence "note:no network surface"
|
|
126
|
+
cleo verify T### --gate cleanupDone --evidence "note:branch task/T### ready for merge"
|
|
127
|
+
|
|
128
|
+
# 3. Complete (CLEO re-validates everything)
|
|
129
|
+
cleo complete T###
|
|
130
|
+
|
|
131
|
+
# 4. Record learning
|
|
132
|
+
cleo memory observe "..." --title "..."
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Common Failure Modes
|
|
136
|
+
|
|
137
|
+
| Exit | Code | Cause | Fix |
|
|
138
|
+
|------|------|-------|-----|
|
|
139
|
+
| — | `E_EVIDENCE_MISSING` | Ran `verify --all` without `--evidence` | Re-run per-gate with atoms |
|
|
140
|
+
| — | `E_EVIDENCE_INSUFFICIENT` | Gate atom kind doesn't match required | See gate-atom table above |
|
|
141
|
+
| — | `E_EVIDENCE_TESTS_FAILED` | `tool:test` exit non-zero | Fix failing tests first |
|
|
142
|
+
| — | `E_EVIDENCE_TOOL_FAILED` | Lint/typecheck/etc exit non-zero | Fix source and re-run |
|
|
143
|
+
| — | `E_EVIDENCE_STALE` | Files or commit changed after verify | Re-verify before complete |
|
|
144
|
+
| — | `E_EVIDENCE_INVALID_DECISION` | Decision ID not found in BRAIN | Use `cleo memory decision-find` |
|
|
145
|
+
| — | `E_FLAG_REMOVED` | Tried `cleo complete --force` | `--force` removed per ADR-051 |
|
|
146
|
+
|
|
147
|
+
## Cache Behavior
|
|
148
|
+
|
|
149
|
+
Tool-evidence results are cached under `.cleo/cache/evidence/<key>.json`,
|
|
150
|
+
keyed on (canonical, cmd, args, HEAD, dirty-tree fingerprint). Parallel
|
|
151
|
+
verifies against identical state coalesce to one execution via a per-key
|
|
152
|
+
lock. Cross-worktree parallelism is bounded by a machine-wide per-tool
|
|
153
|
+
semaphore at `~/.local/share/cleo/locks/tool-<canonical>/`.
|
|
154
|
+
|
|
155
|
+
Tune with `CLEO_TOOL_CONCURRENCY_<TOOL>=<n>` (`0` disables). For most
|
|
156
|
+
worker agents this is set-and-forget; the orchestrator handles tuning.
|
|
157
|
+
|
|
158
|
+
## The Emergency Override
|
|
159
|
+
|
|
160
|
+
In rare incident-response scenarios, the override exists:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
CLEO_OWNER_OVERRIDE=1 \
|
|
164
|
+
CLEO_OWNER_OVERRIDE_REASON="incident 1234 hotfix" \
|
|
165
|
+
cleo verify T### --all --evidence "note:owner-approved"
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
The override appends to `.cleo/audit/force-bypass.jsonl`. Use only when
|
|
169
|
+
the owner has explicitly authorized — never as a routine shortcut to
|
|
170
|
+
skip gates.
|
|
171
|
+
|
|
172
|
+
## What NOT to Do
|
|
173
|
+
|
|
174
|
+
- ❌ Run `cleo complete` without verifying tests actually ran
|
|
175
|
+
- ❌ Run `cleo verify --all` without `--evidence` (REJECTED post-ADR-051)
|
|
176
|
+
- ❌ Use `cleo complete --force` (REMOVED post-ADR-051)
|
|
177
|
+
- ❌ Skip `cleo memory observe` on non-trivial tasks
|
|
178
|
+
- ❌ Self-attest without programmatic proof
|
|
179
|
+
- ❌ Modify files between `verify` and `complete` (caught by staleness check)
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# Implementation Patterns
|
|
2
|
+
|
|
3
|
+
Canonical patterns for executing CLEO tasks. The executor sits at the
|
|
4
|
+
leaf of the orchestrator's pipeline — its job is to take a fully-resolved
|
|
5
|
+
task spec and produce concrete deliverables that pass acceptance criteria.
|
|
6
|
+
This reference codifies the patterns that succeed most consistently.
|
|
7
|
+
|
|
8
|
+
## Read-Before-Write (Mandatory)
|
|
9
|
+
|
|
10
|
+
The repository CLAUDE.md and AGENTS.md make this non-negotiable for CLEO:
|
|
11
|
+
"Read first — understand existing code, patterns, and contracts before
|
|
12
|
+
writing." For the executor, this means a concrete sequence.
|
|
13
|
+
|
|
14
|
+
1. `cleo show <TASK_ID>` — full task body, including hidden acceptance
|
|
15
|
+
criteria, gate config, and prior manifest summaries.
|
|
16
|
+
2. `cleo memory find "<topic-keyword>"` — prior decisions on the same
|
|
17
|
+
surface area. The BRAIN may already have answers.
|
|
18
|
+
3. `Grep` for the symbol or feature name in the target package. Most
|
|
19
|
+
"new" features have a related ancestor that should be extended, not
|
|
20
|
+
rewritten.
|
|
21
|
+
4. `gitnexus_impact({target: "<symbol>"})` — blast radius before any
|
|
22
|
+
edit. HIGH/CRITICAL warnings MUST be reported to the orchestrator
|
|
23
|
+
before proceeding.
|
|
24
|
+
|
|
25
|
+
Skipping any of these steps produces churn the reviewer will flag.
|
|
26
|
+
|
|
27
|
+
## Smallest-Change Principle
|
|
28
|
+
|
|
29
|
+
Match the existing pattern even when you could "improve" it in passing.
|
|
30
|
+
The contract on the executor is to ship the acceptance criteria — not
|
|
31
|
+
to refactor adjacent code. If the existing pattern is genuinely broken,
|
|
32
|
+
file a separate task; do not entangle a fix with the requested feature.
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
GOOD: feat(T1234): add wave-rollup verb
|
|
36
|
+
packages/cleo/src/commands/orchestrate/wave-rollup.ts (new file)
|
|
37
|
+
|
|
38
|
+
BAD: feat(T1234): add wave-rollup verb + clean up unrelated handler
|
|
39
|
+
packages/cleo/src/commands/orchestrate/wave-rollup.ts (new file)
|
|
40
|
+
packages/cleo/src/commands/orchestrate/spawn.ts (drive-by refactor)
|
|
41
|
+
packages/cleo/src/dispatch.ts (rename in pass)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The drive-by changes belong in their own task with their own acceptance
|
|
45
|
+
criteria. Reviewers cannot meaningfully approve a mixed-purpose diff.
|
|
46
|
+
|
|
47
|
+
## File-Placement Patterns
|
|
48
|
+
|
|
49
|
+
Package boundaries are enforced — see AGENTS.md "Package-Boundary Check".
|
|
50
|
+
Use this table when introducing new modules.
|
|
51
|
+
|
|
52
|
+
| Concern | Package | Why |
|
|
53
|
+
|---------|---------|-----|
|
|
54
|
+
| Runtime primitive, domain logic, store, memory | `packages/core/` | SDK; provider-neutral |
|
|
55
|
+
| CLI command handler, dispatch wiring | `packages/cleo/` | CLI surface only |
|
|
56
|
+
| Shared type, envelope, operation, error | `packages/contracts/` | Cross-package contract |
|
|
57
|
+
| Harness adapter, Pi runtime, claude-code adapter | `packages/cleo-os/` | Harness layer |
|
|
58
|
+
| Studio frontend (SvelteKit) | `packages/studio/` | UI |
|
|
59
|
+
| LAFS envelope spec or validator | `packages/lafs/` | Envelope ground truth |
|
|
60
|
+
| .cant DSL or parser | `packages/cant/` | DSL |
|
|
61
|
+
| Agent manifest packaging | `packages/caamp/` | Packaging |
|
|
62
|
+
|
|
63
|
+
When in doubt: state runtime concerns go in `core`; CLI handlers stay
|
|
64
|
+
thin and call into `core`. The repo has previously had to do T1015-style
|
|
65
|
+
relocation epics — avoid creating the next one.
|
|
66
|
+
|
|
67
|
+
## ESM Import Patterns
|
|
68
|
+
|
|
69
|
+
The repository uses ESM with `.js` extensions on import paths (TypeScript
|
|
70
|
+
strict, kebab-case files). The lint will fail any drift.
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
// CORRECT
|
|
74
|
+
import { openCleoDb } from "../store/open-cleo-db.js";
|
|
75
|
+
import type { TaskEnvelope } from "@cleocode/contracts";
|
|
76
|
+
|
|
77
|
+
// WRONG — no .js suffix
|
|
78
|
+
import { openCleoDb } from "../store/open-cleo-db";
|
|
79
|
+
|
|
80
|
+
// WRONG — CommonJS
|
|
81
|
+
const { openCleoDb } = require("../store/open-cleo-db");
|
|
82
|
+
|
|
83
|
+
// WRONG — no relative-path crossing of package boundary
|
|
84
|
+
import { something } from "../../../other-package/src/foo.js";
|
|
85
|
+
// (use a workspace import: import { something } from "@cleocode/other-package")
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Test-First When Possible
|
|
89
|
+
|
|
90
|
+
For new behavior in `packages/core/` or `packages/contracts/`, write the
|
|
91
|
+
test before the implementation. The test file lives alongside the source
|
|
92
|
+
under `__tests__/`.
|
|
93
|
+
|
|
94
|
+
```text
|
|
95
|
+
packages/core/src/store/open-cleo-db.ts
|
|
96
|
+
packages/core/src/store/__tests__/open-cleo-db.test.ts
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
For CLI changes where the behavior is integration-heavy (touches the
|
|
100
|
+
dispatcher, the worktree, the store), prefer an end-to-end test in
|
|
101
|
+
`packages/cleo/__tests__/<verb>.test.ts` that exercises the verb via
|
|
102
|
+
`runMain()` rather than a unit test of an internal helper.
|
|
103
|
+
|
|
104
|
+
## Error Handling Pattern
|
|
105
|
+
|
|
106
|
+
The repository contracts an LAFS envelope `{ success, data?, error?, meta }`
|
|
107
|
+
for every command output. Internal helpers throw typed errors; the
|
|
108
|
+
dispatcher converts to envelope at the boundary.
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
// Internal: throw typed error
|
|
112
|
+
import { TaskNotFoundError } from "@cleocode/contracts";
|
|
113
|
+
if (!task) throw new TaskNotFoundError(taskId);
|
|
114
|
+
|
|
115
|
+
// Boundary: catch and wrap
|
|
116
|
+
try {
|
|
117
|
+
const data = await handler(input);
|
|
118
|
+
return { success: true, data, meta: makeMeta() };
|
|
119
|
+
} catch (err) {
|
|
120
|
+
return formatError(err, makeMeta());
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Do not introduce `catch (err: unknown)` — the AGENTS.md type-safety rules
|
|
125
|
+
ban it. Use the contract's error types and let TypeScript narrow.
|
|
126
|
+
|
|
127
|
+
## Quality Gate Sequence
|
|
128
|
+
|
|
129
|
+
Run these IN ORDER before completing. The contract is in AGENTS.md;
|
|
130
|
+
shortening this sequence has caused two patch-release hotfixes (v2026.4.67,
|
|
131
|
+
v2026.4.69) in past sessions.
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
pnpm biome check --write . # 1. format + lint
|
|
135
|
+
pnpm run build # 2. build (includes typecheck via tsc -b)
|
|
136
|
+
pnpm run typecheck # 3. typecheck — strict TS project refs
|
|
137
|
+
pnpm run test # 4. test (zero new failures)
|
|
138
|
+
git diff --stat HEAD # 5. verify scope matches intent
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Note: `pnpm run build` (esbuild) does NOT run the strict TS project-reference
|
|
142
|
+
typecheck. Always run `pnpm run typecheck` separately before tagging or
|
|
143
|
+
marking complete. This was learned the hard way via L-3 in
|
|
144
|
+
`feedback_typecheck_vs_build.md`.
|
|
145
|
+
|
|
146
|
+
## Worktree Discipline
|
|
147
|
+
|
|
148
|
+
All executor work happens inside the worktree at the path provided in the
|
|
149
|
+
spawn prompt's `## Worktree Setup` section. Operations to AVOID:
|
|
150
|
+
|
|
151
|
+
- `git checkout <other-branch>` — the worktree's branch is sticky.
|
|
152
|
+
- `git reset --hard origin/main` — destroys in-flight commits from other
|
|
153
|
+
worktree-spawn agents (caught in T9354 session: cost 3 PRs of recovery
|
|
154
|
+
via reflog cherry-pick).
|
|
155
|
+
- Editing files outside the worktree path — the git shim will block
|
|
156
|
+
most forbidden operations but the policy boundary is the worktree.
|
|
157
|
+
|
|
158
|
+
When done, the orchestrator integrates via `git merge --no-ff task/<id>`
|
|
159
|
+
per ADR-062 — preserving commit SHAs and task↔commit traceability. The
|
|
160
|
+
executor never touches `main` directly.
|
|
@@ -6,6 +6,10 @@ tier: 2
|
|
|
6
6
|
core: false
|
|
7
7
|
category: recommended
|
|
8
8
|
protocol: validation
|
|
9
|
+
loomStage: validation
|
|
10
|
+
adrRefs:
|
|
11
|
+
- ADR-051
|
|
12
|
+
- ADR-023
|
|
9
13
|
dependencies: []
|
|
10
14
|
sharedResources:
|
|
11
15
|
- subagent-protocol-base
|
|
@@ -41,6 +45,26 @@ Context injection for compliance validation tasks spawned via cleo-subagent. Pro
|
|
|
41
45
|
|
|
42
46
|
---
|
|
43
47
|
|
|
48
|
+
## Out of Scope (T9675)
|
|
49
|
+
|
|
50
|
+
`ct-validator` operates on the **`validation`** LOOM lifecycle stage (stage 7). It performs **static** schema, compliance, and audit checks against artifacts that already exist on disk (specs, ADRs, JSON files, RFC 2119 keyword usage, manifest schemas).
|
|
51
|
+
|
|
52
|
+
This skill does NOT:
|
|
53
|
+
|
|
54
|
+
- Run a test suite, framework detection, or iterative IVT loop. Those belong to **`ct-ivt-looper`** at the `testing` stage (stage 8). When dynamic verification is required — e.g. "does the implementation actually pass its tests?" — chain to `ct-ivt-looper` rather than expanding scope here.
|
|
55
|
+
- Modify code or apply fixes. The validator reports; downstream skills remediate.
|
|
56
|
+
|
|
57
|
+
### Chain handoffs
|
|
58
|
+
|
|
59
|
+
| Direction | When | Handoff |
|
|
60
|
+
|---|---|---|
|
|
61
|
+
| `ct-validator` → `ct-ivt-looper` | Spec is valid but implementation needs dynamic verification | Emit a manifest entry, then dispatch the `testing` stage |
|
|
62
|
+
| `ct-ivt-looper` → `ct-validator` | IVT loop converged; need to audit the resulting artifacts against schema/compliance | Dispatch the `validation` stage after the test convergence record |
|
|
63
|
+
|
|
64
|
+
Governance: see **ADR-051** (programmatic gate integrity) which defines the evidence atoms each stage emits and that the other stage may re-validate, and **ADR-023** (protocol validation dispatch) which routes between them.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
44
68
|
## Validation Methodology
|
|
45
69
|
|
|
46
70
|
### Standard Workflow
|
|
@@ -214,3 +238,23 @@ When invoked by orchestrator, expect these context tokens:
|
|
|
214
238
|
| Vague findings | Unclear remediation | Specific issue + file/line + fix |
|
|
215
239
|
| Missing severity | Can't prioritize | Always classify: critical/warning/suggestion |
|
|
216
240
|
| No remediation | Findings not actionable | Always provide fix for FAIL/PARTIAL |
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## See also / References
|
|
245
|
+
|
|
246
|
+
This skill binds to the **validation** LOOM lifecycle stage. Governing ADRs:
|
|
247
|
+
|
|
248
|
+
- [ADR-051 — programmatic gate integrity](../../../../.cleo/adrs/ADR-051-programmatic-gate-integrity.md) — defines the evidence-atom grammar that the validator emits and re-validates.
|
|
249
|
+
- [ADR-023 — protocol validation dispatch](../../../../.cleo/adrs/ADR-023-protocol-validation-dispatch.md) — defines the protocol-validation routing layer that dispatches to this skill.
|
|
250
|
+
|
|
251
|
+
LOOM coverage matrix: [docs/skills/loom-coverage-matrix.md](../../../../docs/skills/loom-coverage-matrix.md).
|
|
252
|
+
|
|
253
|
+
## See references/
|
|
254
|
+
|
|
255
|
+
Progressive disclosure — load on demand only:
|
|
256
|
+
|
|
257
|
+
- `references/validation-modes.md` — schema/code/document/protocol modes, selection rubric, composition
|
|
258
|
+
- `references/schema-checking.md` — engine selection, draft selection, pitfalls, bulk validation
|
|
259
|
+
- `references/compliance-reports.md` — canonical scaffold, status calculus, severity, ct-ivt-looper integration
|
|
260
|
+
- `references/anti-patterns.md` — twelve validation failure modes with detection and remediation
|