opencode-agent-orchestration-kit 1.0.44 → 1.1.0
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/CONTRIBUTING.md +0 -1
- package/NOTICE.md +1 -5
- package/README.md +37 -49
- package/compatibility.json +7 -0
- package/docs/cli.md +69 -1
- package/docs/commands.md +1 -1
- package/docs/comparison.md +3 -3
- package/docs/compatibility.md +33 -14
- package/docs/installation.md +2 -0
- package/docs/models.md +1 -1
- package/docs/open-design.md +2 -0
- package/docs/opencode-v2.md +190 -0
- package/docs/releases/v1.0.45.md +77 -0
- package/docs/releases/v1.1.0.md +91 -0
- package/docs/supply-chain.md +4 -7
- package/docs/threat-model.md +16 -6
- package/docs/troubleshooting.md +7 -4
- package/docs/workflows.md +27 -4
- package/opencode/AGENTS.md +18 -10
- package/opencode/agents/designer.md +1 -1
- package/opencode/agents/developer.md +60 -6
- package/opencode/agents/lead.md +59 -10
- package/opencode/agents/reviewer.md +7 -0
- package/opencode/agents/scoper.md +1 -0
- package/opencode/agents/specifier.md +1 -0
- package/opencode/commands/autonomous.md +175 -24
- package/opencode/docs/ai/evolution/README.md +5 -4
- package/opencode/docs/ai/evolution/benchmarks/adversarial-scenarios.jsonl +3 -0
- package/opencode/docs/ai/evolution/session-sources.md +12 -0
- package/opencode/docs/ai/harness/agents.md +23 -6
- package/opencode/docs/ai/harness/checks.md +3 -2
- package/opencode/docs/ai/harness/commands.md +7 -4
- package/opencode/docs/ai/harness/skill_registry.json +107 -1
- package/opencode/docs/ai/harness/skill_registry.md +5 -0
- package/opencode/docs/ai/specs/mission-runtime.md +9 -0
- package/opencode/opencode.json +0 -1
- package/opencode/plugins/mission-runtime.test.mjs +15 -3
- package/opencode/plugins/mission-runtime.ts +11 -39
- package/opencode/plugins/oak-tui/server.ts +8 -0
- package/opencode/plugins/oak-tui/tui.tsx +81 -0
- package/opencode/plugins/open-design.ts +12 -0
- package/opencode/plugins/shell-export-guard.ts +13 -23
- package/opencode/plugins/token-tree-usage.tsx +4 -1
- package/opencode/runtime/v1/mission-runtime.ts +73 -0
- package/opencode/runtime/v1/shell-export-guard.ts +9 -0
- package/opencode/runtime/v2/mission-events.d.mts +13 -0
- package/opencode/runtime/v2/mission-events.mjs +64 -0
- package/opencode/runtime/v2/mission-events.test.mjs +120 -0
- package/opencode/runtime/v2/mission-runtime.ts +26 -0
- package/opencode/runtime/v2/open-design.ts +17 -0
- package/opencode/runtime/v2/shell-export-guard.ts +8 -0
- package/opencode/runtime/v2/token-usage.d.mts +15 -0
- package/opencode/runtime/v2/token-usage.mjs +35 -0
- package/opencode/runtime/v2/token-usage.test.mjs +30 -0
- package/opencode/scripts/adversarial-harness.test.mjs +50 -1
- package/opencode/scripts/check-harness.mjs +150 -33
- package/opencode/scripts/check-harness.test.mjs +81 -8
- package/opencode/scripts/collect-session-evidence.mjs +57 -39
- package/opencode/scripts/collect-session-evidence.test.mjs +164 -0
- package/opencode/scripts/deliver.d.mts +37 -0
- package/opencode/scripts/deliver.mjs +204 -0
- package/opencode/scripts/deliver.test.mjs +245 -0
- package/opencode/scripts/loop-state.mjs +50 -1
- package/opencode/scripts/loop-state.test.mjs +33 -0
- package/opencode/scripts/mission-runtime.test.mjs +1 -1
- package/opencode/scripts/mission-status.test.mjs +2 -0
- package/opencode/scripts/runtime-permission-policy.mjs +1 -1
- package/opencode/scripts/runtime-permission-policy.test.mjs +3 -2
- package/opencode/scripts/session-sources.d.mts +6 -0
- package/opencode/scripts/session-sources.mjs +49 -0
- package/opencode/scripts/shell-export-guard-core.d.mts +2 -0
- package/opencode/scripts/shell-export-guard-core.mjs +21 -0
- package/opencode/scripts/shell-export-guard-core.test.mjs +43 -0
- package/opencode/scripts/task-run.d.mts +63 -0
- package/opencode/scripts/task-run.mjs +224 -0
- package/opencode/scripts/task-run.test.mjs +178 -0
- package/opencode/skills/debugging-and-error-recovery/SKILL.md +20 -0
- package/opencode/skills/oak-adversarial-review/SKILL.md +138 -0
- package/opencode/skills/oak-commit/SKILL.md +69 -0
- package/opencode/skills/oak-enrich-task/SKILL.md +109 -0
- package/opencode/skills/oak-runtime-verification/SKILL.md +103 -0
- package/opencode/skills/oak-update-docs/SKILL.md +54 -0
- package/opencode/tools/open-design-tools.d.mts +17 -0
- package/opencode/tools/open-design-tools.mjs +254 -0
- package/opencode/tools/open_design.ts +26 -259
- package/package.json +6 -3
- package/scripts/benchmark-tool-paths.mjs +1 -1
- package/scripts/check-compatibility.mjs +58 -4
- package/scripts/check-compatibility.test.mjs +159 -11
- package/scripts/check-public-boundary.mjs +3 -0
- package/scripts/check-supply-chain.mjs +26 -58
- package/scripts/check-supply-chain.test.mjs +39 -36
- package/scripts/check.sh +42 -7
- package/scripts/manage-installation.mjs +34 -20
- package/scripts/manage-installation.test.mjs +29 -0
- package/scripts/oak.mjs +72 -2
- package/scripts/oak.test.mjs +69 -1
- package/scripts/open-design-http.test.mjs +1 -1
- package/scripts/open-design-tools.test.mjs +49 -0
- package/scripts/opencode-compat-smoke.sh +45 -4
- package/scripts/opencode-v2-smoke.mjs +197 -0
- package/scripts/opencode-v2-smoke.test.mjs +59 -0
- package/scripts/package-smoke.mjs +14 -0
- package/scripts/package-smoke.test.mjs +45 -2
- package/scripts/version.test.mjs +2 -2
- package/supply-chain.json +0 -4
- package/docker/open-design/data/app.sqlite +0 -0
- package/docker/open-design/data/app.sqlite-shm +0 -0
- package/docker/open-design/data/app.sqlite-wal +0 -0
- package/docker/open-design/opencode-auth/log/2026-05-02T105802.log +0 -17
- package/docker/open-design/opencode-auth/log/2026-05-04T102127.log +0 -16
- package/docker/open-design/opencode-auth/opencode.db +0 -0
- package/docker/open-design/opencode-auth/opencode.db-shm +0 -0
- package/docker/open-design/opencode-auth/opencode.db-wal +0 -0
- package/docs/superpowers.md +0 -41
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import test from "node:test";
|
|
6
|
+
import { TaskRunError, appendRunEvent, closeRun, currentBranch, runStatus, startRun } from "./task-run.mjs";
|
|
7
|
+
|
|
8
|
+
const NOW = () => new Date("2026-09-26T10:00:00Z");
|
|
9
|
+
const RANDOM = () => Buffer.from("a1b2c3d4", "hex");
|
|
10
|
+
|
|
11
|
+
function withRoot(callback) {
|
|
12
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "oak-task-run-"));
|
|
13
|
+
try {
|
|
14
|
+
return callback(root);
|
|
15
|
+
} finally {
|
|
16
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
test("start writes the run file and is idempotent on the same branch", () => withRoot((root) => {
|
|
21
|
+
const run = startRun({ root, slug: "add-login", branch: "feat/add-login", now: NOW, random: RANDOM });
|
|
22
|
+
assert.equal(run.run_id, "oak_20260926T100000Z_a1b2c3d4");
|
|
23
|
+
assert.deepEqual(Object.keys(run), ["schema", "run_id", "kind", "change", "branch", "repo", "started_at"]);
|
|
24
|
+
assert.equal(run.repo, path.basename(root));
|
|
25
|
+
assert.equal(fs.readFileSync(path.join(root, ".opencode/runs/.gitignore"), "utf8"), "*\n");
|
|
26
|
+
const again = startRun({ root, slug: "add-login", branch: "feat/add-login", now: NOW, random: () => Buffer.from("ffffffff", "hex") });
|
|
27
|
+
assert.equal(again.run_id, run.run_id);
|
|
28
|
+
}));
|
|
29
|
+
|
|
30
|
+
test("start refuses while a run from another branch is open", () => withRoot((root) => {
|
|
31
|
+
startRun({ root, slug: "a", branch: "feat/a", now: NOW, random: RANDOM });
|
|
32
|
+
assert.throws(() => startRun({ root, slug: "b", branch: "feat/b", now: NOW, random: RANDOM }),
|
|
33
|
+
(error) => error instanceof TaskRunError && error.code === "run_open_on_other_branch");
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
test("rejects unsafe slugs, kinds, event types and keys", () => withRoot((root) => {
|
|
37
|
+
assert.throws(() => startRun({ root, slug: "../x", branch: "b", now: NOW, random: RANDOM }), /slug/);
|
|
38
|
+
assert.throws(() => startRun({ root, slug: "x", branch: "b", kind: "prod", now: NOW, random: RANDOM }), /kind/);
|
|
39
|
+
startRun({ root, slug: "x", branch: "b", now: NOW, random: RANDOM });
|
|
40
|
+
assert.throws(() => appendRunEvent({ root, type: "Review", fields: {} }), /type/);
|
|
41
|
+
assert.throws(() => appendRunEvent({ root, type: "review", fields: { Verdict: "x" } }), /key/);
|
|
42
|
+
}));
|
|
43
|
+
|
|
44
|
+
test("events keep integers bare, dates as strings and strip control characters", () => withRoot((root) => {
|
|
45
|
+
startRun({ root, slug: "x", branch: "b", now: NOW, random: RANDOM });
|
|
46
|
+
appendRunEvent({ root, type: "review", fields: { blocking: "0", nit: "-2", day: "2026-09-26", note: "a\u0007b" }, now: NOW });
|
|
47
|
+
const [line] = fs.readFileSync(path.join(root, ".opencode/runs/active.events.jsonl"), "utf8").trim().split("\n");
|
|
48
|
+
const event = JSON.parse(line);
|
|
49
|
+
assert.equal(event.schema, "oak.event/1");
|
|
50
|
+
assert.equal(event.blocking, 0);
|
|
51
|
+
assert.equal(event.nit, -2);
|
|
52
|
+
assert.equal(event.day, "2026-09-26");
|
|
53
|
+
assert.equal(event.note, "ab");
|
|
54
|
+
}));
|
|
55
|
+
|
|
56
|
+
test("without a run, event and status are no-ops that succeed", () => withRoot((root) => {
|
|
57
|
+
assert.equal(appendRunEvent({ root, type: "review", fields: {} }), null);
|
|
58
|
+
assert.deepEqual(runStatus({ root }), { active: false });
|
|
59
|
+
}));
|
|
60
|
+
|
|
61
|
+
test("status flags stale runs by branch and by age", () => withRoot((root) => {
|
|
62
|
+
startRun({ root, slug: "x", branch: "b", now: NOW, random: RANDOM });
|
|
63
|
+
assert.equal(runStatus({ root, branch: "other", now: NOW }).stale, true);
|
|
64
|
+
assert.equal(runStatus({ root, branch: "b", now: () => new Date("2026-10-04T10:00:01Z") }).stale, true);
|
|
65
|
+
assert.equal(runStatus({ root, branch: "b", now: NOW }).stale, false);
|
|
66
|
+
}));
|
|
67
|
+
|
|
68
|
+
test("close writes the summary inside the root and removes the context", () => withRoot((root) => {
|
|
69
|
+
startRun({ root, slug: "x", branch: "b", now: NOW, random: RANDOM });
|
|
70
|
+
appendRunEvent({ root, type: "review", fields: { verdict: "safe_to_commit" }, now: NOW });
|
|
71
|
+
const out = closeRun({ root, output: "docs/ai/runs/2026-09-26-x/run-summary.json", now: NOW });
|
|
72
|
+
const summary = JSON.parse(fs.readFileSync(path.join(root, out.path), "utf8"));
|
|
73
|
+
assert.equal(summary.schema, "oak.run.summary/1");
|
|
74
|
+
assert.equal(summary.events.length, 1);
|
|
75
|
+
assert.equal(fs.existsSync(path.join(root, ".opencode/runs/active.json")), false);
|
|
76
|
+
}));
|
|
77
|
+
|
|
78
|
+
test("close refuses an output path outside the root and keeps the run open", () => withRoot((root) => {
|
|
79
|
+
startRun({ root, slug: "x", branch: "b", now: NOW, random: RANDOM });
|
|
80
|
+
assert.throws(() => closeRun({ root, output: "../escape.json", now: NOW }), /inside the root/);
|
|
81
|
+
assert.equal(runStatus({ root, branch: "b", now: NOW }).active, true);
|
|
82
|
+
}));
|
|
83
|
+
|
|
84
|
+
test("current branch reads HEAD in a checkout and in a linked worktree", () => withRoot((root) => {
|
|
85
|
+
const main = path.join(root, "main");
|
|
86
|
+
fs.mkdirSync(path.join(main, ".git"), { recursive: true });
|
|
87
|
+
fs.writeFileSync(path.join(main, ".git", "HEAD"), "ref: refs/heads/feat/main\n");
|
|
88
|
+
assert.equal(currentBranch(main), "feat/main");
|
|
89
|
+
|
|
90
|
+
const gitdir = path.join(main, ".git", "worktrees", "linked");
|
|
91
|
+
fs.mkdirSync(gitdir, { recursive: true });
|
|
92
|
+
fs.writeFileSync(path.join(gitdir, "HEAD"), "ref: refs/heads/feat/linked\n");
|
|
93
|
+
const linked = path.join(root, "linked");
|
|
94
|
+
fs.mkdirSync(linked);
|
|
95
|
+
fs.writeFileSync(path.join(linked, ".git"), `gitdir: ${path.relative(linked, gitdir)}\n`);
|
|
96
|
+
assert.equal(currentBranch(linked), "feat/linked");
|
|
97
|
+
}));
|
|
98
|
+
|
|
99
|
+
test("event types come from the closed list", () => withRoot((root) => {
|
|
100
|
+
startRun({ root, slug: "x", branch: "b", now: NOW, random: RANDOM });
|
|
101
|
+
assert.throws(() => appendRunEvent({ root, type: "deploy", fields: {} }), /event type must be one of/);
|
|
102
|
+
}));
|
|
103
|
+
|
|
104
|
+
test("event values are symbolic: no prose, no absolute paths", () => withRoot((root) => {
|
|
105
|
+
startRun({ root, slug: "x", branch: "b", now: NOW, random: RANDOM });
|
|
106
|
+
for (const value of ["/home/someone/secret", "free text prose", "a".repeat(201)]) {
|
|
107
|
+
assert.throws(() => appendRunEvent({ root, type: "review", fields: { note: value } }), /value/);
|
|
108
|
+
}
|
|
109
|
+
const event = appendRunEvent({ root, type: "delivery", fields: { branch: "feat/x-1", parent_session_id: "", verdict: "safe_to_commit" }, now: NOW });
|
|
110
|
+
assert.equal(event.branch, "feat/x-1");
|
|
111
|
+
}));
|
|
112
|
+
|
|
113
|
+
test("start refuses a different change on the same branch", () => withRoot((root) => {
|
|
114
|
+
startRun({ root, slug: "a", branch: "b", now: NOW, random: RANDOM });
|
|
115
|
+
assert.throws(() => startRun({ root, slug: "other", branch: "b", now: NOW, random: RANDOM }),
|
|
116
|
+
(error) => error.code === "run_open_for_other_change");
|
|
117
|
+
}));
|
|
118
|
+
|
|
119
|
+
test("run files and the summary never follow symlinks out of place", () => withRoot((root) => {
|
|
120
|
+
startRun({ root, slug: "x", branch: "b", now: NOW, random: RANDOM });
|
|
121
|
+
const outside = path.join(root, "outside.jsonl");
|
|
122
|
+
fs.writeFileSync(outside, "");
|
|
123
|
+
const events = path.join(root, ".opencode/runs/active.events.jsonl");
|
|
124
|
+
fs.rmSync(events);
|
|
125
|
+
fs.symlinkSync(outside, events);
|
|
126
|
+
assert.throws(() => appendRunEvent({ root, type: "review", fields: {} }), (error) => error.code === "unsafe_path");
|
|
127
|
+
assert.equal(fs.readFileSync(outside, "utf8"), "");
|
|
128
|
+
fs.rmSync(events);
|
|
129
|
+
fs.writeFileSync(events, "");
|
|
130
|
+
|
|
131
|
+
const elsewhere = fs.mkdtempSync(path.join(os.tmpdir(), "oak-task-run-outside-"));
|
|
132
|
+
fs.symlinkSync(elsewhere, path.join(root, "linked"));
|
|
133
|
+
try {
|
|
134
|
+
assert.throws(() => closeRun({ root, output: "linked/new/summary.json", now: NOW }), (error) => error.code === "unsafe_path");
|
|
135
|
+
assert.deepEqual(fs.readdirSync(elsewhere), []);
|
|
136
|
+
} finally {
|
|
137
|
+
fs.rmSync(elsewhere, { recursive: true, force: true });
|
|
138
|
+
}
|
|
139
|
+
assert.throws(() => closeRun({ root, output: ".git/hooks/pre-commit", now: NOW }), (error) => error.code === "unsafe_path");
|
|
140
|
+
assert.equal(runStatus({ root, branch: "b", now: NOW }).active, true);
|
|
141
|
+
}));
|
|
142
|
+
|
|
143
|
+
test("a corrupt run file is a named error, not a crash", () => withRoot((root) => {
|
|
144
|
+
fs.mkdirSync(path.join(root, ".opencode/runs"), { recursive: true });
|
|
145
|
+
fs.writeFileSync(path.join(root, ".opencode/runs/active.json"), "{not json");
|
|
146
|
+
for (const call of [
|
|
147
|
+
() => startRun({ root, slug: "x", branch: "b", now: NOW, random: RANDOM }),
|
|
148
|
+
() => runStatus({ root }),
|
|
149
|
+
() => closeRun({ root }),
|
|
150
|
+
]) {
|
|
151
|
+
assert.throws(call, (error) => error instanceof TaskRunError && error.code === "run_corrupt");
|
|
152
|
+
}
|
|
153
|
+
}));
|
|
154
|
+
|
|
155
|
+
test("a dangling events symlink is refused, not created through", () => withRoot((root) => {
|
|
156
|
+
startRun({ root, slug: "x", branch: "b", now: NOW, random: RANDOM });
|
|
157
|
+
const events = path.join(root, ".opencode/runs/active.events.jsonl");
|
|
158
|
+
const target = path.join(root, "created-outside.jsonl");
|
|
159
|
+
fs.rmSync(events);
|
|
160
|
+
fs.symlinkSync(target, events);
|
|
161
|
+
assert.throws(() => appendRunEvent({ root, type: "review", fields: {} }), (error) => error.code === "unsafe_path");
|
|
162
|
+
assert.equal(fs.existsSync(target), false);
|
|
163
|
+
}));
|
|
164
|
+
|
|
165
|
+
test("the summary cannot land in git's directory under any letter case", () => withRoot((root) => {
|
|
166
|
+
startRun({ root, slug: "x", branch: "b", now: NOW, random: RANDOM });
|
|
167
|
+
for (const output of [".GIT/config", "sub/.Git/hooks/pre-commit"]) {
|
|
168
|
+
assert.throws(() => closeRun({ root, output, now: NOW }), (error) => error.code === "unsafe_path");
|
|
169
|
+
}
|
|
170
|
+
}));
|
|
171
|
+
|
|
172
|
+
test("start never writes the ignore file through a dangling symlink", () => withRoot((root) => {
|
|
173
|
+
fs.mkdirSync(path.join(root, ".opencode/runs"), { recursive: true });
|
|
174
|
+
const escaped = path.join(root, "escaped.txt");
|
|
175
|
+
fs.symlinkSync(escaped, path.join(root, ".opencode/runs/.gitignore"));
|
|
176
|
+
assert.throws(() => startRun({ root, slug: "x", branch: "b", now: NOW, random: RANDOM }), (error) => error.code === "unsafe_path");
|
|
177
|
+
assert.equal(fs.existsSync(escaped), false);
|
|
178
|
+
}));
|
|
@@ -185,6 +185,26 @@ npm run build
|
|
|
185
185
|
npm run dev # Verify in browser
|
|
186
186
|
```
|
|
187
187
|
|
|
188
|
+
## Classify the Failure Before Retrying
|
|
189
|
+
|
|
190
|
+
Before any retry, name which of four kinds the failure is, and quote the line
|
|
191
|
+
of output that decides it:
|
|
192
|
+
|
|
193
|
+
1. **The code is wrong.** Fix the code. This is the only kind that justifies
|
|
194
|
+
changing the implementation.
|
|
195
|
+
2. **The check is wrong.** It asserts something the specification never asked
|
|
196
|
+
for. Correct the assertion and cite the specification. Never delete, skip or
|
|
197
|
+
loosen it to get a pass.
|
|
198
|
+
3. **The harness is misaimed.** The wrong test was selected, state is stale, or
|
|
199
|
+
a tool is missing. Correct that and run again. If the fault is in
|
|
200
|
+
configuration the project owns, report it instead of editing it.
|
|
201
|
+
4. **A piece is missing.** A fixture, a seam or some access does not exist yet.
|
|
202
|
+
That is new work: return to planning.
|
|
203
|
+
|
|
204
|
+
Never re-run a failure unchanged. A flake needs its log line recorded, and the
|
|
205
|
+
same flake twice is a finding. A failure that recurs across tasks should become
|
|
206
|
+
infrastructure: a test, a check or a documented decision.
|
|
207
|
+
|
|
188
208
|
## Error-Specific Patterns
|
|
189
209
|
|
|
190
210
|
### Test Failure Triage
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: oak-adversarial-review
|
|
3
|
+
description: Use for every final review of a diff - an independent pass that assumes the change is wrong, accounts for every changed file, attacks it along fixed dimensions, fact-checks its own findings and ends in an explicit verdict. Use also when the user asks for a red-team or devil's-advocate review.
|
|
4
|
+
phase: review
|
|
5
|
+
domains:
|
|
6
|
+
- review
|
|
7
|
+
- security
|
|
8
|
+
- testing
|
|
9
|
+
stacks:
|
|
10
|
+
- any
|
|
11
|
+
allowed_agents:
|
|
12
|
+
- reviewer
|
|
13
|
+
skill_source: built-in
|
|
14
|
+
origin: null
|
|
15
|
+
status: active
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Adversarial Review
|
|
19
|
+
|
|
20
|
+
## Overview
|
|
21
|
+
|
|
22
|
+
Green tests show only that the tests pass. This review starts from the opposite
|
|
23
|
+
assumption: the change is broken somewhere, and the job is to find where. It
|
|
24
|
+
adds a coverage contract and a fact-check to the canonical review, so that no
|
|
25
|
+
changed file goes unexamined and no finding survives on a misreading.
|
|
26
|
+
|
|
27
|
+
The coverage contract and the drop grounds in Stage 4 follow
|
|
28
|
+
`alibaba/open-code-review` (Apache-2.0).
|
|
29
|
+
|
|
30
|
+
## Stance and context boundary
|
|
31
|
+
|
|
32
|
+
- Attack; do not praise. A finding that cannot be demonstrated is not a finding.
|
|
33
|
+
- Every finding names a file, a line and a concrete input or sequence of steps
|
|
34
|
+
that breaks it.
|
|
35
|
+
- Build your view from the task artifacts (spec, acceptance criteria, plan) and
|
|
36
|
+
the diff. Do not read the author's notes, the developer summary, run events or
|
|
37
|
+
an autonomy log until your findings are written. Checking run *status* is
|
|
38
|
+
allowed.
|
|
39
|
+
- Run in a fresh subagent context, never in the session that wrote the change.
|
|
40
|
+
|
|
41
|
+
## Stage 1 Coverage
|
|
42
|
+
|
|
43
|
+
1. List every changed file as `(path, status)`, where status is added, modified,
|
|
44
|
+
deleted or renamed.
|
|
45
|
+
2. Every file ends as **reviewed** or **skipped**. A skip needs a concrete
|
|
46
|
+
reason, such as "generated file" or "lockfile". "Looked minor" is not a
|
|
47
|
+
reason.
|
|
48
|
+
3. Reviewing a file does not cover its counterpart. A changed interface, test or
|
|
49
|
+
config is its own entry.
|
|
50
|
+
4. Publish the counts: files in the change, reviewed and skipped.
|
|
51
|
+
|
|
52
|
+
## Stage 2 Attack plan
|
|
53
|
+
|
|
54
|
+
For each risk you suspect, write down before reading further:
|
|
55
|
+
|
|
56
|
+
- the expected severity;
|
|
57
|
+
- the stake: where it happens, what breaks and who would notice;
|
|
58
|
+
- exactly what you must read to confirm or refute it.
|
|
59
|
+
|
|
60
|
+
Then read that, and confirm or drop the risk. Do not pad the plan with risks you
|
|
61
|
+
have no reason to suspect.
|
|
62
|
+
|
|
63
|
+
## Stage 3 Dimensions
|
|
64
|
+
|
|
65
|
+
Attack each reviewed file along these nine dimensions:
|
|
66
|
+
|
|
67
|
+
1. **Assumptions.** Does the code assume a value exists, is non-empty, is
|
|
68
|
+
unique, is ordered or arrives only once?
|
|
69
|
+
2. **State preconditions.** What state must hold before this runs, and what
|
|
70
|
+
happens when it does not?
|
|
71
|
+
3. **Authorization.** Is access checked, including on every new read path?
|
|
72
|
+
4. **Input handling.** Empty, whitespace-only, maximum length, wrong type,
|
|
73
|
+
encoding, unicode, and injection into a query, a shell, a template or a log.
|
|
74
|
+
5. **Concurrency and idempotency.** Two callers at once; the same request twice.
|
|
75
|
+
6. **Error paths.** What does the caller actually see when this fails?
|
|
76
|
+
7. **Spec drift.** Behavior the spec asked for that is missing, and behavior
|
|
77
|
+
the diff adds that nobody asked for.
|
|
78
|
+
8. **Conventions.** Consistency with the conventions the repository documents.
|
|
79
|
+
9. **Architecture.** Conformance with the project's own declared rules only,
|
|
80
|
+
never with rules you would prefer.
|
|
81
|
+
|
|
82
|
+
A finding that spans files is filed against a changed file.
|
|
83
|
+
|
|
84
|
+
## Stage 4 Fact-check
|
|
85
|
+
|
|
86
|
+
Re-read every finding against the diff and ask whether the diff proves it wrong.
|
|
87
|
+
Drop a finding on only two grounds:
|
|
88
|
+
|
|
89
|
+
- **A.** The construct it names does not exist in the file it was filed against.
|
|
90
|
+
- **B.** A line of the diff literally contradicts it.
|
|
91
|
+
|
|
92
|
+
Never drop a finding about memory safety, concurrency, a mismatch between a
|
|
93
|
+
declaration and its definition, a behavioral or compatibility change, or a
|
|
94
|
+
parameter that is accepted but unused.
|
|
95
|
+
|
|
96
|
+
Disagreeing with the fix, being unable to confirm the finding, or a wrong line
|
|
97
|
+
number are not grounds to drop it. Correct the citation instead.
|
|
98
|
+
|
|
99
|
+
## Output
|
|
100
|
+
|
|
101
|
+
1. The coverage line comes first:
|
|
102
|
+
`coverage: files_in_change=<n> reviewed=<n> skipped=<n>`, followed by each
|
|
103
|
+
skipped file and its reason.
|
|
104
|
+
2. Findings grouped as **Blocking**, **Should fix** and **Nit**. Each has
|
|
105
|
+
`file:line`, what breaks, the exact trigger and why the existing tests miss
|
|
106
|
+
it. Findings keep the canonical fields of the reviewer policy.
|
|
107
|
+
3. A verdict: `safe_to_commit` or `not_safe_to_commit`.
|
|
108
|
+
|
|
109
|
+
Never invent findings to look thorough. An empty Blocking group is a valid
|
|
110
|
+
result.
|
|
111
|
+
|
|
112
|
+
Return the full report in the review output under the heading
|
|
113
|
+
`Adversarial coverage`. The reviewer is read-only, so the workflow's state-sync
|
|
114
|
+
step copies it verbatim to `docs/ai/runs/<YYYY-MM-DD>-<slug>/oak-adversarial-review.md`
|
|
115
|
+
when a run folder exists. Never leave the report only in the session.
|
|
116
|
+
|
|
117
|
+
## Mapping to OAK verdicts
|
|
118
|
+
|
|
119
|
+
| Adversarial verdict | Canonical verdict |
|
|
120
|
+
| --- | --- |
|
|
121
|
+
| `safe_to_commit`, no Should fix or Nit | `pass` |
|
|
122
|
+
| `safe_to_commit`, with Should fix or Nit | `pass_with_observations` |
|
|
123
|
+
| `not_safe_to_commit` | `needs_changes` |
|
|
124
|
+
| `not_safe_to_commit` because evidence is missing | `blocked` |
|
|
125
|
+
|
|
126
|
+
The canonical verdict is the one the reviewer returns.
|
|
127
|
+
|
|
128
|
+
## Run event
|
|
129
|
+
|
|
130
|
+
When a run is open, end the report with these counts. The state-sync step, not
|
|
131
|
+
the reviewer, records them:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
oak run event --type review review=adversarial files_in_change=<n> files_reviewed=<n> files_skipped=<n> blocking=<n> should_fix=<n> nit=<n> verdict=<safe_to_commit|not_safe_to_commit>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
After a correction pass, emit it again with `unresolved=<n>`. The last event is
|
|
138
|
+
authoritative.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: oak-commit
|
|
3
|
+
description: Use when the user asks to commit or open a pull request, or when /autonomous reaches delivery - produces atomic commits that stage explicit paths only, with messages and a pull-request body written from the actual diff.
|
|
4
|
+
phase: ship
|
|
5
|
+
domains:
|
|
6
|
+
- release
|
|
7
|
+
stacks:
|
|
8
|
+
- any
|
|
9
|
+
allowed_agents:
|
|
10
|
+
- developer
|
|
11
|
+
skill_source: built-in
|
|
12
|
+
origin: null
|
|
13
|
+
status: active
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Commit
|
|
17
|
+
|
|
18
|
+
## When it runs
|
|
19
|
+
|
|
20
|
+
Outside `/autonomous`, commit only when the human asks for it. Under
|
|
21
|
+
`/autonomous`, this skill runs at delivery.
|
|
22
|
+
|
|
23
|
+
Pushing a branch and opening a pull request happen **only** through
|
|
24
|
+
`oak deliver`. Never run `git push` or `gh pr create` yourself.
|
|
25
|
+
|
|
26
|
+
## Branch
|
|
27
|
+
|
|
28
|
+
Work on a feature branch that follows the repository's naming convention, never
|
|
29
|
+
on the default branch. If the repository has no convention, ask. Under
|
|
30
|
+
`/autonomous`, use `<type>/<slug>` and record that decision in the autonomy log.
|
|
31
|
+
|
|
32
|
+
## Stage
|
|
33
|
+
|
|
34
|
+
1. Run `git status` first.
|
|
35
|
+
2. Stage explicit paths only. Never use `git add -A`, `git add .`,
|
|
36
|
+
`git add -u` or `git commit -a`.
|
|
37
|
+
3. List any unrelated change you see, and leave it unstaged. Never stash,
|
|
38
|
+
revert or overwrite someone else's work.
|
|
39
|
+
4. Read the staged diff (`git diff --cached`) and check it for secrets, tokens,
|
|
40
|
+
`.env` values and absolute machine paths before committing.
|
|
41
|
+
|
|
42
|
+
## Commit
|
|
43
|
+
|
|
44
|
+
- One logical change per commit.
|
|
45
|
+
- English, imperative mood. Subject line `<type>: <summary>` under 72
|
|
46
|
+
characters, where type is one of `feat`, `fix`, `refactor`, `test`, `docs`,
|
|
47
|
+
`chore` or `perf`.
|
|
48
|
+
- The body explains why first, then anything a later reader needs to know.
|
|
49
|
+
- Write the message from the staged diff only, not from memory of the session.
|
|
50
|
+
- Never claim that tests pass unless they ran in this session.
|
|
51
|
+
- Never bypass hooks (`--no-verify`, `-n`). If a hook fails, fix the cause.
|
|
52
|
+
- Keep option-like words such as ` -n`, ` -a`, `--all` or ` -- ` out of a
|
|
53
|
+
`-m` message, and do not end it with ` .`: the developer's shell rules deny
|
|
54
|
+
them as hook bypass or bulk staging.
|
|
55
|
+
|
|
56
|
+
## Pull-request body
|
|
57
|
+
|
|
58
|
+
Use these sections:
|
|
59
|
+
|
|
60
|
+
- **What**: the change, in one paragraph.
|
|
61
|
+
- **Why**: the problem it solves.
|
|
62
|
+
- **How**: the approach and the decisions that shaped it.
|
|
63
|
+
- **Verification**: the commands actually run, and what was not covered.
|
|
64
|
+
- **Risk**: what could break, and how to roll it back.
|
|
65
|
+
|
|
66
|
+
Refer to task artifacts and reports by their full repository path in
|
|
67
|
+
backticks instead of copying them into the body; relative Markdown links do not
|
|
68
|
+
resolve in a pull-request body. Write the
|
|
69
|
+
body to a file and pass it to `oak deliver`.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: oak-enrich-task
|
|
3
|
+
description: Use before specifying any feature, fix or refactor that arrives as a short request, roadmap line, screenshot or one-paragraph idea - turns it into an implementable specification with scope, reuse, requirements, acceptance criteria, hostile test cases and the open questions the request leaves ambiguous.
|
|
4
|
+
phase: define
|
|
5
|
+
domains:
|
|
6
|
+
- specification
|
|
7
|
+
- research
|
|
8
|
+
stacks:
|
|
9
|
+
- any
|
|
10
|
+
allowed_agents:
|
|
11
|
+
- lead
|
|
12
|
+
- scoper
|
|
13
|
+
- specifier
|
|
14
|
+
skill_source: built-in
|
|
15
|
+
origin: null
|
|
16
|
+
status: active
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
# Enrich Task
|
|
20
|
+
|
|
21
|
+
## Overview
|
|
22
|
+
|
|
23
|
+
A short request hides most of the decisions an implementation needs. This skill
|
|
24
|
+
turns it into a specification a developer can build and a reviewer can check,
|
|
25
|
+
and it surfaces the questions the request does not answer instead of guessing.
|
|
26
|
+
|
|
27
|
+
The input can be a roadmap line, a phase name, free text, a screenshot or a
|
|
28
|
+
link. Work from what was given. Do not ask for a ticket id and do not fetch one.
|
|
29
|
+
|
|
30
|
+
## When to skip
|
|
31
|
+
|
|
32
|
+
Skip the skill when the request already states acceptance criteria, the files or
|
|
33
|
+
modules it affects, and its non-functional requirements. Say that you skipped it
|
|
34
|
+
and why.
|
|
35
|
+
|
|
36
|
+
If the request is larger than one reviewable change, stop and propose a split
|
|
37
|
+
into smaller tasks instead of enriching the whole thing.
|
|
38
|
+
|
|
39
|
+
## Steps
|
|
40
|
+
|
|
41
|
+
1. **Read the project's own rules first.** Open the repository `AGENTS.md` and
|
|
42
|
+
follow its links to the architecture, standards and data-model documents the
|
|
43
|
+
task touches. Do this before exploring code.
|
|
44
|
+
2. **Understand the problem before the solution.** State who has the problem,
|
|
45
|
+
what they cannot do today and what changes for them. Keep technical depth,
|
|
46
|
+
but do not jump to an implementation.
|
|
47
|
+
3. **Find what to reuse.** Name the existing endpoints, models, components, use
|
|
48
|
+
cases and response shapes the change should build on. Reuse beats new code.
|
|
49
|
+
4. **Test for completeness.** Check that the enhanced version covers:
|
|
50
|
+
- the behavior, including every field that changes;
|
|
51
|
+
- the boundaries the change may cross (modules, services, stored data);
|
|
52
|
+
- the definition of done, including doc and test updates;
|
|
53
|
+
- non-functional requirements: security, performance, observability and
|
|
54
|
+
data integrity.
|
|
55
|
+
5. **Write the enhanced version** in the format below.
|
|
56
|
+
6. **List the open questions.** At minimum consider: one or many, who owns it,
|
|
57
|
+
who may do it, what happens to existing data, and what happens on partial
|
|
58
|
+
failure. Never answer one of these silently inside the requirements.
|
|
59
|
+
|
|
60
|
+
## Output format
|
|
61
|
+
|
|
62
|
+
The output has exactly two top-level headings.
|
|
63
|
+
|
|
64
|
+
```markdown
|
|
65
|
+
## Original
|
|
66
|
+
|
|
67
|
+
<the request as received, unedited>
|
|
68
|
+
|
|
69
|
+
## Enhanced
|
|
70
|
+
|
|
71
|
+
### Summary and scope
|
|
72
|
+
<business summary; an explicit "Out of scope" list>
|
|
73
|
+
|
|
74
|
+
### Reuse
|
|
75
|
+
<existing code, contracts and shapes to build on>
|
|
76
|
+
|
|
77
|
+
### Functional requirements
|
|
78
|
+
|
|
79
|
+
### Non-functional requirements
|
|
80
|
+
|
|
81
|
+
### Affected files and modules
|
|
82
|
+
|
|
83
|
+
### Acceptance criteria and definition of done
|
|
84
|
+
|
|
85
|
+
### Test cases
|
|
86
|
+
<happy path plus hostile cases: empty input, oversized input, wrong encoding,
|
|
87
|
+
injection, concurrent writes, and an entity in a state that forbids the action>
|
|
88
|
+
|
|
89
|
+
### Open questions
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Do not write files unless the caller asks for them. The specification is the
|
|
93
|
+
reply.
|
|
94
|
+
|
|
95
|
+
## Open questions
|
|
96
|
+
|
|
97
|
+
Each question names the decision, the candidate answers and what each answer
|
|
98
|
+
would change. A question that no candidate answer would change is not a
|
|
99
|
+
question; drop it.
|
|
100
|
+
|
|
101
|
+
## Autonomous mode
|
|
102
|
+
|
|
103
|
+
Under `/autonomous`, sort every open question into one of two piles:
|
|
104
|
+
|
|
105
|
+
- **Decided.** The roadmap, the docs or the code answer it. Record the answer,
|
|
106
|
+
the reason and the alternative you rejected in the autonomy log.
|
|
107
|
+
- **Blocking.** It matches one of the `/autonomous` stop reasons. Stop and ask.
|
|
108
|
+
|
|
109
|
+
An empty Blocking pile is the normal case, not a sign that something was missed.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: oak-runtime-verification
|
|
3
|
+
description: Use after tests and validation pass and before the final review, whenever a change could show up at runtime - a screen, a command, an endpoint, a job or a data store - to prove the change works in the running system, including its failure path, with repeatable steps and minimal evidence.
|
|
4
|
+
phase: verify
|
|
5
|
+
domains:
|
|
6
|
+
- testing
|
|
7
|
+
- evaluation
|
|
8
|
+
stacks:
|
|
9
|
+
- any
|
|
10
|
+
allowed_agents:
|
|
11
|
+
- developer
|
|
12
|
+
skill_source: built-in
|
|
13
|
+
origin: null
|
|
14
|
+
status: active
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Runtime Verification
|
|
18
|
+
|
|
19
|
+
## Overview
|
|
20
|
+
|
|
21
|
+
Tests prove that the tests pass. This step proves that the change works in the
|
|
22
|
+
running system. It runs after validation is green and before the final review,
|
|
23
|
+
and it exercises the real surface the change touches: the happy path and the
|
|
24
|
+
failure path.
|
|
25
|
+
|
|
26
|
+
## Decide the surface
|
|
27
|
+
|
|
28
|
+
Pick exactly one surface per affected area:
|
|
29
|
+
|
|
30
|
+
| Surface | Use when | What to do |
|
|
31
|
+
| --- | --- | --- |
|
|
32
|
+
| `none` | refactor, types, build-only change | Skip, and state why in one line. |
|
|
33
|
+
| `command` | a CLI, script or job | Run it and inspect its effect and logs. |
|
|
34
|
+
| `endpoint` | an HTTP, RPC or message handler | Call it and inspect the response and effect. |
|
|
35
|
+
| `store` | a database, cache, file or queue | Query it before and after. |
|
|
36
|
+
| `screen` | a user interface | Drive the real application. |
|
|
37
|
+
|
|
38
|
+
Never open a browser or a simulator for a change that has no screen.
|
|
39
|
+
|
|
40
|
+
## Find how the project is exercised
|
|
41
|
+
|
|
42
|
+
Look in this order and stop at the first answer:
|
|
43
|
+
|
|
44
|
+
1. The project's own mandatory steps, or its `AGENTS.md`.
|
|
45
|
+
2. The documents those link to.
|
|
46
|
+
3. The repository itself: manifest scripts, container files, an end-to-end
|
|
47
|
+
suite, a seed command.
|
|
48
|
+
|
|
49
|
+
A project with no way to run the surface is a finding to report. It is not a
|
|
50
|
+
reason to skip the step.
|
|
51
|
+
|
|
52
|
+
## Exercise it
|
|
53
|
+
|
|
54
|
+
- Run the happy path, then at least one failure path.
|
|
55
|
+
- Check the real effect, not just the exit code: the row written, the message
|
|
56
|
+
sent, the file created, the log line, the cache entry.
|
|
57
|
+
- Write the steps down so someone else can repeat them exactly.
|
|
58
|
+
- For a migration, use the real engine and check three things:
|
|
59
|
+
1. applying it a second time changes nothing;
|
|
60
|
+
2. it migrates a store that already holds data;
|
|
61
|
+
3. the engine and its version are named in the report.
|
|
62
|
+
|
|
63
|
+
## Evidence
|
|
64
|
+
|
|
65
|
+
Collect the cheapest evidence that proves the point:
|
|
66
|
+
|
|
67
|
+
- `screen`: one still image per state;
|
|
68
|
+
- `command`: the verbatim output and exit code, as text;
|
|
69
|
+
- `endpoint`: the request sent, and the status and body received;
|
|
70
|
+
- `store`: the query, and the rows before and after.
|
|
71
|
+
|
|
72
|
+
Do not record video. Keep evidence in a temporary directory outside the
|
|
73
|
+
repository, and never commit it.
|
|
74
|
+
|
|
75
|
+
## Report
|
|
76
|
+
|
|
77
|
+
The report states:
|
|
78
|
+
|
|
79
|
+
- what was run;
|
|
80
|
+
- the evidence, by file name only;
|
|
81
|
+
- what was observed, including the failure path;
|
|
82
|
+
- a **Not covered** list;
|
|
83
|
+
- a verdict: `works_as_specified`, `does_not`, or `could_not_be_verified`.
|
|
84
|
+
|
|
85
|
+
`could_not_be_verified` names exactly what was missing.
|
|
86
|
+
|
|
87
|
+
Record the result in the developer's Verification Envelope as
|
|
88
|
+
`runtime_verification: { surface, verdict, report }`.
|
|
89
|
+
|
|
90
|
+
## When it cannot run
|
|
91
|
+
|
|
92
|
+
If the step needs something you do not have (a credential, a paid service, a
|
|
93
|
+
device, an unavailable dependency), say so and return `could_not_be_verified`.
|
|
94
|
+
Under `/autonomous` this is a stop reason. Never report the step as done on the
|
|
95
|
+
strength of unit tests.
|
|
96
|
+
|
|
97
|
+
## Run event
|
|
98
|
+
|
|
99
|
+
When a run is open, emit one event per surface, with counts and enums only:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
oak run event --type runtime_verification surface=<none|command|endpoint|store|screen> verdict=<works_as_specified|does_not|could_not_be_verified> evidence_count=<n>
|
|
103
|
+
```
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: oak-update-docs
|
|
3
|
+
description: Use as the last step of any change that altered behavior, contracts, schema, architecture, setup or a roadmap item, before committing - updates the documentation the repository treats as its source of truth so the next session starts from accurate context.
|
|
4
|
+
phase: ship
|
|
5
|
+
domains:
|
|
6
|
+
- documentation
|
|
7
|
+
stacks:
|
|
8
|
+
- any
|
|
9
|
+
allowed_agents:
|
|
10
|
+
- developer
|
|
11
|
+
skill_source: built-in
|
|
12
|
+
origin: null
|
|
13
|
+
status: active
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Update Docs
|
|
17
|
+
|
|
18
|
+
## Overview
|
|
19
|
+
|
|
20
|
+
The next session, human or agent, starts from the documentation. A change that
|
|
21
|
+
leaves it stale costs more later than it saves now. Updating the owning docs is
|
|
22
|
+
part of the change, not a follow-up, and it happens before delivery.
|
|
23
|
+
|
|
24
|
+
## Map each change to its owning doc
|
|
25
|
+
|
|
26
|
+
| The change touched | Update |
|
|
27
|
+
| --- | --- |
|
|
28
|
+
| an API contract | the API document |
|
|
29
|
+
| a schema, migration or model | the data-model document |
|
|
30
|
+
| a module or service boundary | the architecture document, plus an ADR if a rule was bent |
|
|
31
|
+
| a new command, script or environment variable | the setup guide |
|
|
32
|
+
| behavior a reader would not expect | the spec, or an ADR |
|
|
33
|
+
| a roadmap item it completes | the roadmap entry and its status |
|
|
34
|
+
|
|
35
|
+
The roadmap entry is the update most often forgotten. Check it every time.
|
|
36
|
+
|
|
37
|
+
## How to write the update
|
|
38
|
+
|
|
39
|
+
- Match the structure the document already has.
|
|
40
|
+
- Explain intent and constraints. Do not paraphrase the code.
|
|
41
|
+
- Fix every statement the change made false, not just the paragraph you were
|
|
42
|
+
looking for.
|
|
43
|
+
- Do not create a new document when one already owns the topic.
|
|
44
|
+
- Do not add a changelog entry unless the project keeps a changelog.
|
|
45
|
+
- Do not leave a TODO in place of the update.
|
|
46
|
+
|
|
47
|
+
## Report
|
|
48
|
+
|
|
49
|
+
End with one of:
|
|
50
|
+
|
|
51
|
+
- the list of documents updated; or
|
|
52
|
+
- the documents you checked, and why each was unaffected.
|
|
53
|
+
|
|
54
|
+
"No docs needed" without that list is not a report.
|