instar 1.3.190 → 1.3.192

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.
@@ -0,0 +1,81 @@
1
+ # Side-Effects Review — Tier classifier + Tier-1 PR path (Step A)
2
+
3
+ **Slug:** `tier-classifier-and-tier1-path`
4
+ **Date:** 2026-06-01
5
+ **Author:** echo
6
+ **Spec:** `docs/specs/tier-classifier-and-tier1-path-spec.md` (approved by Justin + abbreviated convergence)
7
+ **Project:** Step A of the Tiered Development Process (`docs/projects/tiered-dev-process/PROJECT.md`)
8
+
9
+ ## Summary of the change
10
+
11
+ Teaches the instar-dev commit gate to (1) compute + print a **tier signal** (size + risk),
12
+ (2) let the agent **declare** the tier in its trace, (3) enforce the **chosen** tier's
13
+ requirement set — adding a **Tier-1 path** (ELI16 + side-effects, no pre-approved
14
+ converged spec) — and (4) **audit** every decision. First executable instance of the
15
+ constitution's *The Body and the Mind*: the gate informs, the agent decides, the decision
16
+ is recorded. Strictly additive: a commit with no declared tier behaves exactly as before.
17
+
18
+ **Files changed (in-scope):**
19
+ - `scripts/lib/classify-tier.mjs` (NEW) — pure `classifyTier({inScopeFiles, addedLines,
20
+ deletedLines, addedDiffText})` → `{suggestedTier, sizeTier, riskFloor, reasons}` +
21
+ `decideRequirementSet(declaredTier)`. Size tier (≤40 LOC / ≤3 files = 1). Risk floor
22
+ raised by safety-invariant proximity, irreversibility, migration/fleet-rollout, and
23
+ (diff-text-gated) new-capability. `suggestedTier = max(size, risk)`, never 3.
24
+ - `scripts/instar-dev-precommit.js` — Step 3.5 computes + prints the signal (via
25
+ `git diff --cached --numstat`); Step 4.5 reads `trace.tier`/`trace.tierReasoning`,
26
+ routes via `decideRequirementSet`, writes one audit line to
27
+ `.instar/instar-dev-decisions.jsonl` (incl. `riskFloor` + `belowFloor`), and runs the
28
+ Tier-1 path (`enforceTier1`: staged ELI16 + side-effects, sha-matched) when `tier===1`.
29
+ **Tier-2/3/no-tier fall through to the existing Steps 5–8 unchanged.**
30
+ - `skills/instar-dev/scripts/write-trace.mjs` — new flags `--tier`, `--tier-reasoning`,
31
+ `--eli16-path`, `--side-effects-path`; `--spec` optional when `--tier 1`. Undeclared
32
+ traces round-trip byte-identically to the legacy shape.
33
+
34
+ **Files changed (tests, not in-scope):**
35
+ - `tests/unit/classify-tier.test.ts` (NEW, 47) — size boundaries, every risk signal incl.
36
+ fleet-rollout, `max(size,risk)`, never-3, config-hint-gated new-capability.
37
+ - `tests/unit/write-trace-tier.test.ts` (NEW, 5) — Tier-1/Tier-2/no-tier trace round-trips,
38
+ side-effects-path default, missing-ELI16 rejection.
39
+ - `tests/unit/instar-dev-precommit-deferrals.test.ts` — named back-compat regression
40
+ (no-tier trace + approved spec passes the full Tier-2 path) + audit-line shape (incl.
41
+ `riskFloor`). `-sha-error.test.ts` — sandbox updated for the new static import.
42
+
43
+ ## Blast radius
44
+
45
+ Additive and back-compatible. The classifier is pure (no I/O). The gate gains two new
46
+ steps (3.5 signal print, 4.5 tier routing + audit) **before** the existing Steps 5–8,
47
+ which are unchanged for Tier-2/no-tier. The default (no `tier` in trace) selects the exact
48
+ current requirement set — verified by the named back-compat regression test. The only new
49
+ relaxation is the Tier-1 path, still requiring ELI16 + side-effects. The risk floor is a
50
+ loud, audited signal (`belowFloor`), never a silent downgrade; the audit is a learning
51
+ signal, not a security boundary (PR review + the auto-merge spot-check are the human
52
+ gates). New runtime cost: one `git diff --cached --numstat` + one classify call + one
53
+ appended JSONL line per in-scope commit.
54
+
55
+ ## Risks considered
56
+
57
+ - **Tier-1 as a loophole?** The agent declares its own tier; a risk change that evades the
58
+ heuristic globs isn't flagged `belowFloor`. Mitigation (documented in the spec §4): the
59
+ PR is the review surface for every Tier-1, the auto-merge operator spot-check is the
60
+ human gate, and `belowFloor` rates are reviewed on a cadence (Close the Loop) so blind
61
+ spots surface and the risk list grows.
62
+ - **Breaking existing commits?** No — `no-tier → Tier-2` is byte-identical to today; named
63
+ regression test guards it.
64
+ - **Leaking sensitive data?** No — the audit records tiers, reasons, file counts, LOC; no
65
+ content.
66
+
67
+ ## Migration parity
68
+
69
+ `instar-dev-precommit.js` + `write-trace.mjs` ship in the instar repo for agents
70
+ *developing* instar; they are not installed into arbitrary agent homes by `init`. No
71
+ `PostUpdateMigrator` change for end agents. The instar-dev skill awareness update is a
72
+ later project step (Step C).
73
+
74
+ ## Tests / lint
75
+
76
+ `npx tsc --noEmit` exit 0; Step-A unit tests green (`classify-tier` 47, `write-trace-tier`
77
+ 5, gate `-deferrals`/`-sha-error` 13/1). Note: the worktree's full unit suite shows 28
78
+ **pre-existing** failures (TunnelManager, watchdog-bind-probe, serendipity-capture,
79
+ esm-compliance, no-silent-fallbacks) that fail **identically with and without** this change
80
+ (verified by stash-test) — local-environment/harness/lint artifacts (real config + tunnel
81
+ reachability + node v25.6.1), independent of Step A and green in clean CI.