lean-agent-harness 1.4.0 → 2.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/AGENTS.md +1 -1
- package/CHANGELOG.md +24 -0
- package/CLAUDE.md +1 -1
- package/GLOSSARY.md +4 -3
- package/README.md +4 -4
- package/adapters/opencode/commands/{review.md → review-audit.md} +1 -1
- package/bin/cli.js +59 -1
- package/install.sh +38 -0
- package/manifest.tsv +2 -0
- package/package.json +2 -1
- package/retired.tsv +10 -0
- package/skills/orchestrate/SKILL.md +9 -1
- package/skills/plan-flow/SKILL.md +7 -6
- package/skills/review-audit/SKILL.md +32 -0
- package/skills/security-audit/SKILL.md +18 -8
- package/skills/security-audit/references/exclusions.md +19 -0
- package/adapters/opencode/commands/audit-code.md +0 -5
- package/skills/audit-code/SKILL.md +0 -14
- package/skills/code-review/SKILL.md +0 -42
- package/skills/review/SKILL.md +0 -22
- package/skills/review/agents/openai.yaml +0 -2
- /package/skills/{audit-code → review-audit}/agents/openai.yaml +0 -0
package/AGENTS.md
CHANGED
|
@@ -21,7 +21,7 @@ Single source of truth for all coding agents. Engineering rigor, deterministic e
|
|
|
21
21
|
* **State:** the plan and `- [ ]` checklist live in `.tasks/current.md` so a compacted session resumes without re-asking. Delete it after a clean `commit`.
|
|
22
22
|
* **Branch:** tracked work happens on `feature/<task-slug>`, never `main`/`master`.
|
|
23
23
|
|
|
24
|
-
Workflow skills (explicit invocation only): `plan-flow <task>` → `orchestrate` → `review` → `commit [hint]
|
|
24
|
+
Workflow skills (explicit invocation only): `plan-flow <task>` → `orchestrate` → `review-audit` → `commit [hint]`. Skills are referenced by name; each agent resolves them from its own skills directory.
|
|
25
25
|
|
|
26
26
|
## 3. Hard Rules
|
|
27
27
|
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,30 @@ All notable changes to this project are documented here. Format based on [Keep a
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [2.1.0] - 2026-11-06
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Upgrading no longer leaves the skills and commands removed from the package: after each directory is copied, both installers delete the deployed `review`, `audit-code` and `code-review` skills and the OpenCode `review` and `audit-code` commands, listed in the new `retired.tsv`. A copy is deleted only if it carries the marker line it shipped with, so a skill of your own with the same name is kept, and never if the package ships that path again. This applies to every profile, local and global. Reinstalling over an install made before this release cleans them, so the by-hand removal described under 2.0.0 is no longer needed.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- `plan-flow` stops and asks once (replace or continue) when `.tasks/current.md` still has a `- [ ]` item, instead of silently overwriting the unfinished plan. Default: continue.
|
|
16
|
+
- `orchestrate` ends every slice with a fixed report table: files, RED and GREEN (exact test summary line), deviations from the plan and the diff hash.
|
|
17
|
+
|
|
18
|
+
## [2.0.0] - 2026-11-06
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- **Breaking:** the `review` workflow skill is now `review-audit` (command `/review-audit`), and `code-audit` and `code-review` are removed (see Removed). The workflow goes from five skills to four.
|
|
23
|
+
- `review-audit` no longer collides with the review commands built into the agents. It takes an optional effort level (`low|medium|high`), runs one reviewer per axis (Correctness, Readability & Bloat, Architecture & Boundaries, Safety & Performance), verifies each finding before reporting it, and lists security hotspots as WARNINGs for human review. It only reports; fixes stay in `orchestrate`.
|
|
24
|
+
- `security-audit` owns the scan scope (a path, else the whole workspace), verifies findings with a confidence threshold of 8 out of 10, reports an exploit scenario per finding, adds a data-exposure vector, and keeps its exclusions in `references/exclusions.md`.
|
|
25
|
+
|
|
26
|
+
### Removed
|
|
27
|
+
|
|
28
|
+
- The `code-audit` skill and its OpenCode command: a thin wrapper over `security-audit`, whose scope section now covers it. Use `security-audit` on a path instead of `/audit-code`.
|
|
29
|
+
- The `code-review` skill: its axes now live inside `review-audit`. Directories left over from an older install (`skills/review`, `skills/audit-code`, `skills/code-review`) are not deleted by the installer; remove them by hand.
|
|
30
|
+
|
|
7
31
|
## [1.4.0] - 2026-11-04
|
|
8
32
|
|
|
9
33
|
### Added
|
package/CLAUDE.md
CHANGED
|
@@ -9,5 +9,5 @@ Read and adhere strictly to:
|
|
|
9
9
|
## Fast Command Reference
|
|
10
10
|
- `/plan-flow <task>`: Read-only architecture analysis & ODD milestone checklist.
|
|
11
11
|
- `/orchestrate <task>`: Step-by-step implementation, RED-GREEN loop, and DoD validation.
|
|
12
|
-
- `/review [target]`: Risk-based git diff audit against SonarQube quality gates.
|
|
12
|
+
- `/review-audit [target]`: Risk-based git diff audit against SonarQube quality gates.
|
|
13
13
|
- `/commit [hint]`: Quality gate verification and atomic Conventional Commit.
|
package/GLOSSARY.md
CHANGED
|
@@ -20,13 +20,14 @@ Single source of truth for the domain vocabulary of this project. Both human eng
|
|
|
20
20
|
| **Slice** | One feature-complete ODD unit (e.g., migration + model + service + tests). | `- [ ] Slice N:` checklist item | No fragmented single-line micro-slices. |
|
|
21
21
|
| **DoD (Definition of Done)** | Verification gate: 0 linter/compiler errors, passing tests with cited terminal output, no debug residue, glossary-aligned naming, isolated `git status`. | `orchestrate` skill DoD; `commit` skill step 1 | Evidence without raw terminal output is invalid. |
|
|
22
22
|
| **RED / GREEN / REFACTOR** | Test-first cycle: prove the gap with a failing test, implement minimally to pass, refactor for SOLID. | `testing` skill | Never assert GREEN without running the runner. |
|
|
23
|
-
| **Workflow Skill** | A skill invoked explicitly (`plan-flow`, `orchestrate`, `review
|
|
23
|
+
| **Workflow Skill** | A skill invoked explicitly (`plan-flow`, `orchestrate`, `review-audit`, `commit`). It carries `disable-model-invocation: true`, so its description costs no standing tokens. | `skills/<name>/SKILL.md` | Role instructions (Planner, Orchestrator) live inside the skill; no separate agent or command files. |
|
|
24
24
|
| **Skill** | A self-contained Agent Skills playbook (`name` + `description` frontmatter) loaded on demand. | `skills/<name>/SKILL.md` | `name` equals the folder; keep each around 70 lines or fewer. |
|
|
25
25
|
| **Inline Task** | Work small enough to skip planning ceremony (≤ 1 file, < 30 lines, cosmetic). | `AGENTS.md` § 2 | Auditable through `git diff` alone. |
|
|
26
|
-
| **Risk Tier** | `low` or `high` tag on each planned slice. `high` = a high-risk item named in `AGENTS.md` § 2 (auth/authz, data migration or deletion, secrets/config, public interface, concurrency). | `Risk:` field in `plan-flow` output | High-risk slices get a fresh-context verifier (`orchestrate`) and review (`review`); low-risk slices keep the single DoD gate. |
|
|
26
|
+
| **Risk Tier** | `low` or `high` tag on each planned slice. `high` = a high-risk item named in `AGENTS.md` § 2 (auth/authz, data migration or deletion, secrets/config, public interface, concurrency). | `Risk:` field in `plan-flow` output | High-risk slices get a fresh-context verifier (`orchestrate`) and review (`review-audit`); low-risk slices keep the single DoD gate. |
|
|
27
27
|
| **Change Budget** | Limit of 400 changed lines per work unit. | `orchestrate` § Change budget (enforced by `commit`) | Rule text lives only in `orchestrate`. |
|
|
28
|
-
| **Blocker** | A review finding (Blocker or Critical) that blocks `commit` until fixed. | `review` verdict | WARNING and SUGGESTION never block and never trigger fixes. |
|
|
28
|
+
| **Blocker** | A review finding (Blocker or Critical) that blocks `commit` until fixed. | `review-audit` verdict | WARNING and SUGGESTION never block and never trigger fixes. |
|
|
29
29
|
| **Profile** | Installation subset: `full` (default) deploys every skill; `core` omits the skills listed in `profile-extras.txt`. | `--profile core|full` | Only the `skills` directory is filtered; rules and workflow skills always install; both installers must produce identical trees. |
|
|
30
|
+
| **Retired Skill** | A skill or command removed from the package. After copying a directory, both installers delete its deployed copy. | `retired.tsv` (path + marker line) | Deleted only if the copy carries the marker line it shipped with and the package no longer ships the path; a user's own skill with the same name is kept. |
|
|
30
31
|
| **Seed Glossary** | Minimal domain-glossary template deployed to client projects when they have none. | `templates/GLOSSARY.md` | At most 1500 bytes (token budget test); never overwrites an existing `GLOSSARY.md`. |
|
|
31
32
|
| **Source Override** | Testability hook: installers use `LAH_SOURCE` (shell) or `LAH_FAKE_HOME`/`LAH_FAKE_CWD` (CLI exports) in tests. | `install.sh`, `bin/cli.js` | Must never alter default behavior when unset. |
|
|
32
33
|
| **Pinned Download** | A `curl` install fixed to a release and verified: `LAH_VERSION` selects the tag `vX.Y.Z` (default: the branch), `LAH_SHA256` makes `install.sh` abort before deploying when the archive differs, `LAH_ARCHIVE_URL` replaces the download URL (mirrors, tests). | `install.sh` | Without `LAH_SHA256` the archive is installed unverified and the installer says so. GitHub archives are not guaranteed byte-stable: recompute a stale checksum from a trusted copy before assuming tampering. |
|
package/README.md
CHANGED
|
@@ -8,11 +8,11 @@ One rule file and one skill format for **Claude Code**, **Pi**, **OpenCode**, **
|
|
|
8
8
|
|
|
9
9
|
Everything ships as [Agent Skills](https://agentskills.io) (`skills/<name>/SKILL.md`, with `name` and `description` frontmatter) plus a single `AGENTS.md`. There are no separate command or subagent files, so there is nothing to translate per tool.
|
|
10
10
|
|
|
11
|
-
* **Domain skills** (`testing`, `security-audit`, `db-migration`, `diagnosing-bugs`, `
|
|
12
|
-
* **Workflow skills** (`plan-flow`, `orchestrate`, `review
|
|
11
|
+
* **Domain skills** (`testing`, `security-audit`, `db-migration`, `diagnosing-bugs`, `impeccable`, `humanizer`, `diagram-design`) load on demand when the task matches their description.
|
|
12
|
+
* **Workflow skills** (`plan-flow`, `orchestrate`, `review-audit`, `commit`) set `disable-model-invocation: true` (plus `agents/openai.yaml` for Codex). Claude Code, Pi, Cursor and Codex never offer them to the model, so their descriptions cost no tokens until you call them. OpenCode and Copilot ignore the flag and list them (one short line each). The Planner and Orchestrator roles live inside `plan-flow` and `orchestrate`. Slices tagged `Risk: high` are verified and reviewed in a fresh context; every `SKILL.md` stays under 3000 bytes and long detail loads from `references/`.
|
|
13
13
|
|
|
14
14
|
```text
|
|
15
|
-
plan-flow <task> → orchestrate → review [target] → commit [hint]
|
|
15
|
+
plan-flow <task> → orchestrate → review-audit [low|medium|high] [target] → commit [hint]
|
|
16
16
|
(read-only plan) (RED-GREEN, DoD) (audit git diff) (atomic commit) (security scan)
|
|
17
17
|
```
|
|
18
18
|
|
|
@@ -46,7 +46,7 @@ curl -fsSL https://raw.githubusercontent.com/lnardev/lean-agent-harness/main/ins
|
|
|
46
46
|
**Pinning and verifying the `curl` install.** The one-liner runs the `main` branch unless you pin it:
|
|
47
47
|
|
|
48
48
|
```bash
|
|
49
|
-
curl -fsSL https://raw.githubusercontent.com/lnardev/lean-agent-harness/main/install.sh | LAH_VERSION=1.
|
|
49
|
+
curl -fsSL https://raw.githubusercontent.com/lnardev/lean-agent-harness/main/install.sh | LAH_VERSION=2.1.0 LAH_SHA256=<sha256-of-the-archive> bash -s -- --global --auto
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
`LAH_VERSION` downloads that release tag. `LAH_SHA256` makes the installer abort, before deploying anything, if the archive does not match. Without it the installer says that the checksum is not verified. GitHub does not publish archive checksums, so compute the value once from a copy you trust, for example `shasum -a 256` on the archive of that tag. GitHub's generated archives are not guaranteed to stay byte-identical over time, so if a previously valid checksum stops matching, recompute it from a trusted copy before assuming tampering.
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
description: Risk-based audit of uncommitted changes against quality gates before committing. Invoke explicitly.
|
|
3
3
|
argument-hint: "[target]"
|
|
4
4
|
---
|
|
5
|
-
Load the `review` skill and follow it. Arguments: $ARGUMENTS
|
|
5
|
+
Load the `review-audit` skill and follow it. Arguments: $ARGUMENTS
|
package/bin/cli.js
CHANGED
|
@@ -233,6 +233,61 @@ function writeInstruction(srcPath, destPath, mode = "") {
|
|
|
233
233
|
else fs.copyFileSync(srcPath, destPath);
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
+
/**
|
|
237
|
+
* True when a directory above the last component of rel is a symlink. Stops at the first component
|
|
238
|
+
* that is missing or not a directory: nothing below it can be followed.
|
|
239
|
+
*
|
|
240
|
+
* @param {string} dest Deployed directory (itself may be a symlink)
|
|
241
|
+
* @param {string} rel Path relative to dest
|
|
242
|
+
* @returns {boolean}
|
|
243
|
+
*/
|
|
244
|
+
function goesThroughLink(dest, rel) {
|
|
245
|
+
let current = dest;
|
|
246
|
+
for (const part of rel.split("/").slice(0, -1)) {
|
|
247
|
+
current = path.join(current, part);
|
|
248
|
+
const stat = fs.lstatSync(current, { throwIfNoEntry: false });
|
|
249
|
+
if (!stat || !stat.isDirectory()) return stat?.isSymbolicLink() === true;
|
|
250
|
+
}
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Delete the deployed copies of skills and commands removed from the package (retired.tsv).
|
|
256
|
+
* An entry applies to the manifest row whose src prefixes it. The copy is deleted only when it
|
|
257
|
+
* carries the marker line it shipped with, so a skill of the user's own with the same name
|
|
258
|
+
* survives, and never when the package ships that path again. A row must be exactly
|
|
259
|
+
* "path<TAB>marker" and the path must have no empty, "." or ".." segment; anything else is skipped,
|
|
260
|
+
* as is a path that goes through a symlinked directory.
|
|
261
|
+
*
|
|
262
|
+
* @param {string} src Manifest src of the directory row
|
|
263
|
+
* @param {string} dest Deployed directory
|
|
264
|
+
*/
|
|
265
|
+
function retireStale(src, dest) {
|
|
266
|
+
const list = path.join(PKG_ROOT, "retired.tsv");
|
|
267
|
+
if (!fs.existsSync(list)) return;
|
|
268
|
+
const text = fs.readFileSync(list, "utf8");
|
|
269
|
+
for (const line of text.replace(/\r/g, "").split("\n")) {
|
|
270
|
+
if (line.trim() === "" || line.startsWith("#")) continue;
|
|
271
|
+
const [entry, marker, ...extra] = line.split("\t");
|
|
272
|
+
if (!entry.startsWith(`${src}/`)) continue;
|
|
273
|
+
const rel = entry.slice(src.length + 1);
|
|
274
|
+
if (!marker || extra.length > 0 || rel.split("/").some((part) => ["", ".", ".."].includes(part))) {
|
|
275
|
+
console.error(`retired.tsv: ignoring malformed row ${JSON.stringify(line)}`);
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
if (fs.existsSync(path.join(PKG_ROOT, entry))) continue;
|
|
279
|
+
if (goesThroughLink(dest, rel)) continue;
|
|
280
|
+
const target = path.join(dest, rel);
|
|
281
|
+
const stat = fs.statSync(target, { throwIfNoEntry: false });
|
|
282
|
+
if (!stat) continue;
|
|
283
|
+
const probe = stat.isDirectory() ? path.join(target, "SKILL.md") : target;
|
|
284
|
+
const lines = fs.existsSync(probe) ? fs.readFileSync(probe, "utf8").replace(/\r/g, "").split("\n") : [];
|
|
285
|
+
if (!lines.includes(marker)) continue;
|
|
286
|
+
fs.rmSync(target, { recursive: true });
|
|
287
|
+
console.log(` retired ${path.relative(dest, target)}`);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
236
291
|
/**
|
|
237
292
|
* @param {Target} t
|
|
238
293
|
* @param {Set<string>} [exclude] skill folders to skip (profile)
|
|
@@ -246,7 +301,10 @@ function deployTarget(t, exclude = new Set()) {
|
|
|
246
301
|
if (kind === "file") writeInstruction(from, to, mode);
|
|
247
302
|
else if (kind === "settings-hook") mergeHook(from, to);
|
|
248
303
|
else if (kind === "opencode-permission") mergePermission(from, to);
|
|
249
|
-
else
|
|
304
|
+
else {
|
|
305
|
+
copyDir(from, to, src === "skills" ? exclude : new Set());
|
|
306
|
+
retireStale(src, to);
|
|
307
|
+
}
|
|
250
308
|
}
|
|
251
309
|
const label = t.base.replace(process.env.LAH_FAKE_HOME || os.homedir(), "~");
|
|
252
310
|
console.log(` ${c.green}✔${c.reset} ${label} (${t.name})`);
|
package/install.sh
CHANGED
|
@@ -287,6 +287,43 @@ copy_dir() {
|
|
|
287
287
|
done
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
+
# through_link <deployed dir> <relative path>: true when a directory above the last component is a symlink.
|
|
291
|
+
through_link() {
|
|
292
|
+
local walk="$1" rest="$2"
|
|
293
|
+
while [[ "$rest" == */* ]]; do
|
|
294
|
+
walk="$walk/${rest%%/*}"
|
|
295
|
+
[ -L "$walk" ] && return 0
|
|
296
|
+
rest="${rest#*/}"
|
|
297
|
+
done
|
|
298
|
+
return 1
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
# retire_stale <manifest src> <deployed dir>: delete the deployed copy of each retired.tsv path under <src>,
|
|
302
|
+
# only when it carries the marker line it shipped with (the file, or SKILL.md of a directory) and the
|
|
303
|
+
# package no longer ships it. A row must be exactly path<TAB>marker, with no empty, . or .. path segment;
|
|
304
|
+
# anything else is skipped, as is a path that goes through a symlinked directory. Mirrors bin/cli.js.
|
|
305
|
+
retire_stale() {
|
|
306
|
+
local src="$1" dest="$2" line entry marker rel target probe
|
|
307
|
+
[ -f "$SRC/retired.tsv" ] || return 0
|
|
308
|
+
while IFS= read -r line || [ -n "$line" ]; do
|
|
309
|
+
case "$line" in ""|\#*) continue ;; esac
|
|
310
|
+
entry="${line%%"$TAB"*}"
|
|
311
|
+
case "$entry" in "$src"/*) ;; *) continue ;; esac
|
|
312
|
+
rel="${entry#"$src"/}"
|
|
313
|
+
case "$line" in *"$TAB"*) marker="${line#*"$TAB"}" ;; *) marker="" ;; esac
|
|
314
|
+
case "$marker" in ""|*"$TAB"*) echo "retired.tsv: ignoring malformed row $line" >&2; continue ;; esac
|
|
315
|
+
case "/$rel/" in //*|*//*|*/./*|*/../*) echo "retired.tsv: ignoring malformed row $line" >&2; continue ;; esac
|
|
316
|
+
[ -e "$SRC/$entry" ] && continue
|
|
317
|
+
through_link "$dest" "$rel" && continue
|
|
318
|
+
target="$dest/$rel"
|
|
319
|
+
if [ -d "$target" ]; then probe="$target/SKILL.md"; else probe="$target"; fi
|
|
320
|
+
if [ -f "$probe" ] && grep -Fxq -- "$marker" "$probe"; then
|
|
321
|
+
rm -r -- "$target"
|
|
322
|
+
echo " retired $rel"
|
|
323
|
+
fi
|
|
324
|
+
done < <(tr -d '\r' < "$SRC/retired.tsv")
|
|
325
|
+
}
|
|
326
|
+
|
|
290
327
|
is_selected() {
|
|
291
328
|
[ "$1" = "core" ] && [ "$TARGET_MODE" = "local" ] && return 0
|
|
292
329
|
case " $SELECTED " in *" $1 "*) return 0 ;; *) return 1 ;; esac
|
|
@@ -306,6 +343,7 @@ while IFS="$TAB" read -r scope tgt kind src dest mode; do
|
|
|
306
343
|
dir)
|
|
307
344
|
if [ "$src" = "skills" ]; then copy_dir "$SRC/$src" "$BASE_DIR/$dest" skip-extras
|
|
308
345
|
else copy_dir "$SRC/$src" "$BASE_DIR/$dest"; fi
|
|
346
|
+
retire_stale "$src" "$BASE_DIR/$dest"
|
|
309
347
|
;;
|
|
310
348
|
esac
|
|
311
349
|
case " $DEPLOYED " in *" $tgt "*) ;; *) DEPLOYED="$DEPLOYED $tgt"; echo -e " ${GREEN}✔${NC} $tgt" ;; esac
|
package/manifest.tsv
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
# mode: if-missing (file kind only: never overwrite an existing dest)
|
|
9
9
|
# merge (file kind only: back up a divergent dest and merge its rules into the deployed
|
|
10
10
|
# file as a "Project Rules" section; a dest the harness itself deployed is replaced bare)
|
|
11
|
+
# After a dir row is copied, the installers also delete the deployed copy of every path under its src that
|
|
12
|
+
# retired.tsv lists (skills and commands removed from the package).
|
|
11
13
|
# Target "agents" = the cross-tool Agent Skills location (.agents/skills), read natively by
|
|
12
14
|
# Pi, OpenCode, Codex, Copilot and Cursor. Claude Code reads .claude/skills instead.
|
|
13
15
|
local core file AGENTS.md AGENTS.md merge
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lean-agent-harness",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Zero-bloat, token-efficient agent harness for Claude Code, Cursor, OpenCode, Pi, Codex, and CommandCode.",
|
|
5
5
|
"author": "lnardev",
|
|
6
6
|
"bin": {
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"install.sh",
|
|
22
22
|
"manifest.tsv",
|
|
23
23
|
"profile-extras.txt",
|
|
24
|
+
"retired.tsv",
|
|
24
25
|
"adapters/",
|
|
25
26
|
"skills/",
|
|
26
27
|
"guard/claude/",
|
package/retired.tsv
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Skills and commands removed from the package. After copying a directory row, both installers delete
|
|
2
|
+
# the deployed copy of each path below, but only when it carries the marker line it shipped with
|
|
3
|
+
# (the file itself, or SKILL.md for a directory) and the package does not ship that path any more.
|
|
4
|
+
# A skill of the user's own with the same name has a different description and is kept.
|
|
5
|
+
# Columns (tab-separated): path (under a manifest row's src) marker line. Exactly two columns, marker non-empty.
|
|
6
|
+
skills/review description: Risk-based audit of uncommitted changes against quality gates before committing. Invoke explicitly.
|
|
7
|
+
skills/audit-code description: Deep static security audit of a path or the whole workspace. Invoke explicitly.
|
|
8
|
+
skills/code-review description: Fast, multi-axis technical code review targeting SonarQube quality gates (Bugs, Code Smells), architectural debt, and diff hygiene.
|
|
9
|
+
adapters/opencode/commands/review.md description: Risk-based audit of uncommitted changes against quality gates before committing. Invoke explicitly.
|
|
10
|
+
adapters/opencode/commands/audit-code.md description: Deep static security audit of a path or the whole workspace. Invoke explicitly.
|
|
@@ -35,4 +35,12 @@ After the DoD, verify in a fresh context (subagent or new session; if the host h
|
|
|
35
35
|
## Failure
|
|
36
36
|
Apply the Circuit Breaker from `AGENTS.md`, reverting only this slice's files.
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
## Slice report
|
|
39
|
+
After each `- [x]`, print this table, one row per slice:
|
|
40
|
+
|
|
41
|
+
| Slice | Files | RED | GREEN | Deviations from plan | Diff hash |
|
|
42
|
+
| :--- | :--- | :--- | :--- | :--- | :--- |
|
|
43
|
+
|
|
44
|
+
RED and GREEN quote the exact test summary line; write `none` when nothing deviated.
|
|
45
|
+
|
|
46
|
+
Mark `- [x]` in `.tasks/current.md`, advance, and when all are done ask the user to run `review-audit`.
|
|
@@ -10,12 +10,13 @@ disable-model-invocation: true
|
|
|
10
10
|
Task: the arguments given with this invocation. Read-only architect: inspect, design, slice, write the plan. Never modify source, install packages, or mutate git. The only file you may write is `.tasks/current.md`.
|
|
11
11
|
|
|
12
12
|
## Steps
|
|
13
|
-
1. **
|
|
14
|
-
2. **
|
|
15
|
-
3. **
|
|
16
|
-
4. **
|
|
17
|
-
5. **
|
|
18
|
-
6. **
|
|
13
|
+
1. **Active plan gate:** if `.tasks/current.md` exists and still has a `- [ ]` item, STOP and ask exactly ONE question: replace or continue it? Default: continue (tell the user to run `orchestrate`). Replace only on an explicit answer.
|
|
14
|
+
2. **Scope gate:** if the task is broad or ambiguous, STOP and ask exactly ONE question on the main decision, with a recommended default answerable in one word. No questionnaires.
|
|
15
|
+
3. **Size gate:** ≤ 1 file, cosmetic or < 30 lines → declare an **Inline Task** with a one-step guideline; skip slicing.
|
|
16
|
+
4. **Ground truth:** read `GLOSSARY.md` (if present) and the active manifest (`package.json`, `go.mod`, `Cargo.toml`, `pyproject.toml`, `Makefile`) for real test/lint commands. Verify paths, exports and signatures before citing them.
|
|
17
|
+
5. **Design:** deep modules, minimal public interfaces, no shallow pass-through layers.
|
|
18
|
+
6. **Slice:** feature-complete units (e.g. migration + model + service + tests). Each defines its RED state (failing test) first and names the skills it needs (`testing`, `security-audit`, `diagnosing-bugs`; `db-migration`, `impeccable` if installed).
|
|
19
|
+
7. **Persist** the plan to `.tasks/current.md`, then tell the user to run `orchestrate`.
|
|
19
20
|
|
|
20
21
|
## Output format
|
|
21
22
|
```markdown
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: review-audit
|
|
3
|
+
description: Risk-based audit of uncommitted changes against quality gates before committing. Invoke explicitly.
|
|
4
|
+
argument-hint: [low|medium|high] [target]
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# review-audit
|
|
9
|
+
|
|
10
|
+
Arguments: optional effort level, then optional target (file, branch or PR). Default: **medium**.
|
|
11
|
+
|
|
12
|
+
* **low**: report only Blocker/Critical findings you are certain of.
|
|
13
|
+
* **medium**: add WARNING findings you verified in the code.
|
|
14
|
+
* **high**: add SUGGESTION findings and uncertain ones, each marked PLAUSIBLE.
|
|
15
|
+
|
|
16
|
+
1. Run `git diff` (or inspect the given target file/branch).
|
|
17
|
+
2. Check new symbols against `GLOSSARY.md` (skip if absent).
|
|
18
|
+
3. Review by axis: one reviewer per axis. Report only actionable defects, each with its exact structural remedy.
|
|
19
|
+
* **Correctness:** null dereferences, type coercion, resource leaks, off-by-one, inverted conditions, unchecked errors.
|
|
20
|
+
* **Readability & Bloat:** dead code and commented-out code, cyclomatic complexity > 10, nesting > 3 levels, functions > 30 lines, duplicated blocks, cryptic names (`data`, `temp`, `res`).
|
|
21
|
+
* **Architecture & Boundaries:** transport or DB logic leaking into domain layers, refactors that only shuffle lines, premature interfaces and shallow wrappers.
|
|
22
|
+
* **Safety & Performance:** injection, authorization gaps, unsanitized input at system borders (load `security-audit` if touching persistence/auth), unbounded queries, N+1, heavy work inside hot loops.
|
|
23
|
+
Security hotspots (crypto, CORS, cookies, regex on user input, deserialization, dependency/config changes) are not defects: list each once as a WARNING for human review, with the reason.
|
|
24
|
+
If the host has subagents, run the axis reviewers in parallel, each with only the diff and its axis. Otherwise run them sequential in this context and state that in the verdict.
|
|
25
|
+
4. Verify pass: re-read the cited code for every candidate finding and drop any you cannot reproduce from the code. Mark survivors CONFIRMED, or PLAUSIBLE when the level allows uncertain ones.
|
|
26
|
+
5. Verify the diff fulfils the planned slice with no scope creep.
|
|
27
|
+
If any slice is `Risk: high`, run this review in a fresh context (subagent or new session) so it does not judge code it just wrote; if the host has neither, state that the review ran in the authoring context.
|
|
28
|
+
Record the hash of the diff you judged (`git add -N <new files>`, then `git diff HEAD | git hash-object --stdin`) in the verdict; a later change to that hash needs a new review. If the work is already committed, `git diff HEAD` is empty and always hashes the same: hash `git diff <base>...HEAD` instead.
|
|
29
|
+
6. Verdict: any Blocker/Critical → list required fixes, each with the exact structural remedy, and block `commit`. Clean → approve and tell the user to run `commit`.
|
|
30
|
+
WARNING and SUGGESTION are listed once in the verdict. They never trigger fixes or another review round.
|
|
31
|
+
|
|
32
|
+
Report only. Never edit code in a review: fixes go through `orchestrate`, so the judged hash stays valid.
|
|
@@ -7,26 +7,36 @@ description: Static and architectural security review. Identifies injection risk
|
|
|
7
7
|
|
|
8
8
|
Inspect the codebase for concrete security defects where an untrusted principal crosses a real trust boundary or abuses application logic.
|
|
9
9
|
|
|
10
|
+
## Scope
|
|
11
|
+
|
|
12
|
+
The given path, else the whole workspace. Skip `.git`, `node_modules`, `.env*`, vendored code and binaries.
|
|
13
|
+
|
|
10
14
|
## Audit Vectors
|
|
11
15
|
|
|
12
16
|
1. **Authentication & Authorization:** Missing guards on routes/handlers, broken object-level authorization (IDOR), privilege escalation, unsafe token/session handling.
|
|
13
17
|
2. **Input Validation & Injection:** Raw SQL/NoSQL queries, unsanitized command execution (`os/exec`, `eval`), unescaped template rendering (XSS), path traversal (`../`).
|
|
14
18
|
3. **Secrets & Configurations:** Hardcoded API keys, exposed `.env` values, secrets leaked in logs or error traces, weak CORS policies, insecure crypto defaults.
|
|
15
19
|
4. **Data Boundaries & Deserialization:** Insecure deserialization, mass assignment vulnerabilities, improper SSRF protections on external fetches.
|
|
16
|
-
5. **Supply Chain & Dependencies:** Known CVEs
|
|
20
|
+
5. **Supply Chain & Dependencies:** Known CVEs reported by the project's auditor, deprecated packages, unsafe imports.
|
|
21
|
+
6. **Data Exposure:** PII or secrets in logs, API responses leaking fields, debug information in production.
|
|
22
|
+
|
|
23
|
+
## Verification
|
|
24
|
+
|
|
25
|
+
Verify pass: for each candidate, re-read the code and trace the data from the untrusted source to the sensitive sink. Give it a confidence from 1 to 10 and drop anything below 8. Apply `references/exclusions.md` before reporting. Subagents may verify findings in parallel; without them, verify sequentially and say so.
|
|
17
26
|
|
|
18
27
|
## Reporting Standard
|
|
19
28
|
|
|
20
|
-
|
|
21
|
-
- **Location:**
|
|
22
|
-
- **Vulnerability:**
|
|
23
|
-
- **
|
|
24
|
-
- **
|
|
29
|
+
Per finding:
|
|
30
|
+
- **Location:** file path and line range.
|
|
31
|
+
- **Vulnerability:** classification and mechanism of failure.
|
|
32
|
+
- **Severity:** Critical, High, Medium or Low, with the concrete blast radius.
|
|
33
|
+
- **Exploit Scenario:** the attacker's steps from untrusted input to impact. No path, no finding.
|
|
34
|
+
- **Surgical Fix:** minimal diff or exact remediation.
|
|
25
35
|
|
|
26
36
|
## Output Format
|
|
27
37
|
|
|
28
|
-
|
|
38
|
+
A Markdown matrix, then the exploit scenarios:
|
|
29
39
|
|
|
30
40
|
| Severity | Category | File:Line | Description | Remediation |
|
|
31
41
|
| :--- | :--- | :--- | :--- | :--- |
|
|
32
|
-
| High | Injection | `server/db.go:45` | Unsanitized query input | Use parameterized query |
|
|
42
|
+
| High | Injection | `server/db.go:45` | Unsanitized query input | Use parameterized query |
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Exclusions
|
|
2
|
+
|
|
3
|
+
Do not report:
|
|
4
|
+
|
|
5
|
+
1. Denial of service, resource exhaustion, rate limiting, memory or CPU consumption.
|
|
6
|
+
2. Missing hardening or best practices with no concrete vulnerability.
|
|
7
|
+
3. Outdated third-party libraries, unless the project's own auditor (`npm audit`, `pip-audit`, `govulncheck`) flags them.
|
|
8
|
+
4. Race conditions or timing attacks that are only theoretical.
|
|
9
|
+
5. Regex injection, regex DoS, log spoofing, missing audit logs.
|
|
10
|
+
6. Path-only SSRF: it matters only if the host or protocol is controllable.
|
|
11
|
+
7. Findings in documentation or in test-only files.
|
|
12
|
+
8. Client-side missing auth checks: the server is responsible for them.
|
|
13
|
+
9. Memory-safety issues in memory-safe languages.
|
|
14
|
+
|
|
15
|
+
Trusted inputs:
|
|
16
|
+
|
|
17
|
+
* Environment variables and CLI flags are trusted. An attack that needs to control one is invalid.
|
|
18
|
+
* UUIDs are unguessable and need no validation.
|
|
19
|
+
* Logging non-PII data is not a finding. Logging secrets, passwords or PII is.
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: audit-code
|
|
3
|
-
description: Deep static security audit of a path or the whole workspace. Invoke explicitly.
|
|
4
|
-
argument-hint: [path]
|
|
5
|
-
disable-model-invocation: true
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# audit-code
|
|
9
|
-
|
|
10
|
-
Scope: the given path, else the whole workspace. Skip `.git`, `node_modules`, `.env*`, vendored code, binaries.
|
|
11
|
-
|
|
12
|
-
1. Load the `security-audit` skill.
|
|
13
|
-
2. Scan: broken authn/authz (IDOR, missing guards), injection (SQL/NoSQL/XSS/command), hardcoded secrets, insecure deserialization, SSRF, unsanitized trust-boundary crossings, dependency CVEs.
|
|
14
|
-
3. Report a severity matrix (Critical/High/Med/Low) with `file:line`, failure mechanism, blast radius and the surgical fix. Every finding needs a concrete attack path; no theoretical issues.
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: code-review
|
|
3
|
-
description: Fast, multi-axis technical code review targeting SonarQube quality gates (Bugs, Code Smells), architectural debt, and diff hygiene.
|
|
4
|
-
disable-model-invocation: true
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Code Review
|
|
8
|
-
|
|
9
|
-
Evaluate diffs and PRs strictly against four technical axes. Focus on defects that fail SonarQube quality gates and produce technical debt. Propose the exact remedy, not just the critique.
|
|
10
|
-
|
|
11
|
-
## The Review Axes
|
|
12
|
-
|
|
13
|
-
1. **Correctness (SonarQube Bugs):**
|
|
14
|
-
- Null pointer dereferences, unhandled nil/null checks, and type-coercion bugs.
|
|
15
|
-
- Resource leaks: unclosed files, DB connections, HTTP request/response bodies.
|
|
16
|
-
- Logic defects: off-by-one errors, infinite loops, inverted conditions, unchecked error returns.
|
|
17
|
-
|
|
18
|
-
2. **Readability & Bloat (SonarQube Code Smells):**
|
|
19
|
-
- Dead code: unreachable branches, unused variables, orphan imports, commented-out legacy code.
|
|
20
|
-
- Cyclomatic complexity: deep nesting (>3 levels), massive switch statements without default cases.
|
|
21
|
-
- Duplication: identical logic blocks that must be consolidated.
|
|
22
|
-
- Naming: cryptic variable names without domain meaning (`data`, `temp`, `res`).
|
|
23
|
-
|
|
24
|
-
3. **Architecture & Boundaries:**
|
|
25
|
-
- Layer leaks: transport or DB logic leaking into domain/business layers.
|
|
26
|
-
- Relocated complexity: refactors that merely shuffle lines instead of eliminating branches.
|
|
27
|
-
- Unnecessary abstractions: premature interfaces, boilerplate wrappers with only one implementation.
|
|
28
|
-
|
|
29
|
-
4. **Safety & Performance:**
|
|
30
|
-
- Unbounded queries, N+1 patterns, unconstrained pagination.
|
|
31
|
-
- Input validation at system borders (complements `security-audit`).
|
|
32
|
-
- Heavy allocations or redundant calculations inside loops or hot paths.
|
|
33
|
-
|
|
34
|
-
## Findings Format
|
|
35
|
-
|
|
36
|
-
Report only actionable issues ordered by severity:
|
|
37
|
-
|
|
38
|
-
- **Critical:** Blocks merge / SonarQube red gate. Runtime crash, resource leak, or data corruption.
|
|
39
|
-
- **Required:** Must fix. Code smells, complexity spikes, unhandled boundary cases, broken invariants.
|
|
40
|
-
- **Nit / Optional:** Style suggestions, minor syntactic sugar. Non-blocking.
|
|
41
|
-
|
|
42
|
-
For every reported issue, prescribe the exact structural remedy: *extract helper*, *close resource with defer/finally*, *dispatch via map*, or *collapse redundant branch*.
|
package/skills/review/SKILL.md
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: review
|
|
3
|
-
description: Risk-based audit of uncommitted changes against quality gates before committing. Invoke explicitly.
|
|
4
|
-
argument-hint: [target]
|
|
5
|
-
disable-model-invocation: true
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# review
|
|
9
|
-
|
|
10
|
-
1. Run `git diff` (or inspect the given target file/branch).
|
|
11
|
-
2. Check new symbols against `GLOSSARY.md` (skip if absent).
|
|
12
|
-
3. Quality gates:
|
|
13
|
-
* **Bugs:** logic anomalies, unhandled null/undefined, resource leaks.
|
|
14
|
-
* **Vulnerabilities:** injection, authorization gaps, unsanitized input (load `security-audit` if touching persistence/auth).
|
|
15
|
-
* **Smells:** cyclomatic complexity > 10, functions > 30 lines, shallow wrappers, dead code.
|
|
16
|
-
4. Verify the diff fulfils the planned slice with no scope creep.
|
|
17
|
-
If any slice is `Risk: high`, run this review in a fresh context (subagent or new session) so it does not judge code it just wrote; if the host has neither, state that the review ran in the authoring context.
|
|
18
|
-
Record the hash of the diff you judged (`git add -N <new files>`, then `git diff HEAD | git hash-object --stdin`) in the verdict; a later change to that hash needs a new review. If the work is already committed, `git diff HEAD` is empty and always hashes the same: hash `git diff <base>...HEAD` instead.
|
|
19
|
-
5. Verdict: any Blocker/Critical → list required fixes and block `commit`. Clean → approve and tell the user to run `commit`.
|
|
20
|
-
WARNING and SUGGESTION are listed once in the verdict. They never trigger fixes or another review round.
|
|
21
|
-
|
|
22
|
-
For deeper multi-axis review rules use the `code-review` skill.
|
|
File without changes
|