lean-agent-harness 2.0.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/CHANGELOG.md +11 -0
- package/GLOSSARY.md +1 -0
- package/README.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 +8 -0
- package/skills/plan-flow/SKILL.md +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,17 @@ 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
|
+
|
|
7
18
|
## [2.0.0] - 2026-11-06
|
|
8
19
|
|
|
9
20
|
### Changed
|
package/GLOSSARY.md
CHANGED
|
@@ -27,6 +27,7 @@ Single source of truth for the domain vocabulary of this project. Both human eng
|
|
|
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
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
|
@@ -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=2.
|
|
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.
|
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": "2.
|
|
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
|
+
## 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
|
+
|
|
38
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
|