@agenit/cli 1.0.4 → 1.1.1

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.
Files changed (5) hide show
  1. package/CHANGELOG.md +287 -0
  2. package/README.md +10 -2
  3. package/cli.js +39456 -34022
  4. package/config/flow.toml +396 -0
  5. package/package.json +4 -2
package/CHANGELOG.md CHANGED
@@ -3,6 +3,293 @@
3
3
  All notable changes to `@agenit/cli` are documented here. The project
4
4
  follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
5
 
6
+ ## [1.1.1] - 2026-05-08
7
+
8
+ A patch bump on top of 1.1.0 covering the rebuild after the
9
+ end-of-session summarizer landed.
10
+
11
+ ### Added
12
+
13
+ - Bundle now ships a `dist/config/` directory containing a default
14
+ `flow.toml` so a fresh install has working `[routing]`,
15
+ `[advisor]`, and `[session]` defaults out of the box without the
16
+ user having to copy anything from the repo.
17
+
18
+ ### Fixed
19
+
20
+ - Squad runner config plumbing — `helperTimeoutPlannerSecs` and
21
+ `reducerModel` now flow correctly from `[squad]` in `flow.toml`
22
+ through `SquadRunConfig` to the helper dispatcher. Existing
23
+ configs without these keys keep the prior behaviour
24
+ (`helperTimeoutSecs × 3` for planner, planner model for reducer).
25
+
26
+ ## [1.1.0] - 2026-05-08
27
+
28
+ A minor bump because this batch is dominated by new user-facing
29
+ flows: an interactive `/init` walkthrough, a Codex-style `/goal start`
30
+ gate with plan generation + speckit pipeline, a Claude-style advisor
31
+ mechanism the agent can call mid-tick, per-goal model pinning, and an
32
+ end-of-session summarizer that finally populates the project memory
33
+ files. None of these were in 1.0.5.
34
+
35
+ ### Added
36
+
37
+ - **Interactive `/init` flow.** When `/init` runs without `--profile`
38
+ and the REPL is attached, a modal walks the user through:
39
+ - Profile picker (arrow-key nav over `automotive` / `embedded` /
40
+ `web` / `generic`, with the auto-detected option marked).
41
+ - `r` key triggers a Gemini classification call that scans the
42
+ project's high-signal files (`package.json`, `CMakeLists.txt`,
43
+ `Cargo.toml`, etc.) and recommends a profile.
44
+ - Custom-agent gate after profile selection — if Y, Gemini
45
+ drafts a project-tailored `SKILL.md` and writes it to
46
+ `.gemini/skills/<project>-agent/`. Verifier confirms Gemini-CLI
47
+ sees it on the next session start.
48
+ - GEMINI.md seeder added alongside AGENTS.md (Gemini-CLI's
49
+ auto-loaded persona file). Both files now include a
50
+ `## Recommended skills` section listing per-profile skills.
51
+ - **Interactive `/goal start` gate.** When `[goal]
52
+ interactive_planning = true` (default), `/goal start` opens a
53
+ sequence of modals before spawning the runner:
54
+ - **Plan-first gate**: Y to plan via the speckit pipeline, N to
55
+ start the runner immediately, Esc to cancel.
56
+ - **Plan-model picker** (arrow-key nav): pick the model the
57
+ speckit specify+plan calls run on. Shows tier (smart / fast /
58
+ cheap / default) + the resolved model + provider per row.
59
+ - **Streaming plan loader**: speckit-specify runs first, then
60
+ speckit-plan. Phase headers stream in (`## phase: speckit-plan`)
61
+ so the user sees what's currently happening. Output is the
62
+ `plan.md` speckit wrote to `.specify/specs/<fid>/`.
63
+ - **Plan approval modal**: shows the on-disk plan.md. Y to
64
+ approve, E to drop into `$EDITOR` on the file, N/Esc to cancel.
65
+ - **Optional `clarify` gate** — runs the new two-pass clarify
66
+ (see below) when Y.
67
+ - **Optional `tasks` gate** — runs `speckit-tasks`, captures
68
+ `tasks.md`, injects it into every tick's prompt under
69
+ `## Task list`.
70
+ - **Worker-model picker**: same picker, different purpose —
71
+ pins the model the autonomous runner uses for every tick.
72
+ - The chosen models + speckit fid + tasks body live on
73
+ `GoalSpec` so the run is reproducible.
74
+ - **Two-pass clarify flow.** The original `speckit-clarify` skill
75
+ expected interactive Q&A inside the model context, which doesn't
76
+ work in headless dispatch (it usually no-ops). The new flow:
77
+ - Pass 1: `extractClarifyQuestions` asks the model for ≤5
78
+ numbered questions about the spec. Streams.
79
+ - User walks the questions one at a time via a `ClarifyQAModal`
80
+ with text input. Esc skips a question; Ctrl-C cancels the whole
81
+ flow; empty Enter is treated as skip.
82
+ - Pass 2: `applyClarifications` sends the original spec + Q&A
83
+ pairs back, asks for a complete updated `spec.md` body, writes
84
+ it to disk. Streams.
85
+ - **Advisor side-call mechanism.** The autonomous runner's main
86
+ model can emit `[[ADVISOR: <question>]]` mid-tick; the driver
87
+ detects the marker (top-level only — markers inside fenced code
88
+ blocks are ignored), side-calls a `tier: "smart"` GeminiClient
89
+ with the audit context, persists the reply to
90
+ `goal-turns/turn-NNN-advisor.md`, and injects it into the next
91
+ turn's user prompt under `## Advisor reply (consult #N)`. New
92
+ `[advisor]` config section: `enabled`, `tier` (default `smart`),
93
+ `max_consults_per_goal` (default 5), `redact_paths` (default
94
+ true — replaces absolute paths in the audit-note context with
95
+ `<path>` placeholders before sending to the smart model).
96
+ Recursive markers in the reply are stripped to keep the loop
97
+ terminating. Advisor cost entries land in `costs.json` with
98
+ `kind: "advisor"` (matching turn integer to the tick that emitted
99
+ the marker; the existing tick entries gain `kind: "tick"`). New
100
+ `/goal advisor [<turn>]` subcommand prints a stored reply.
101
+ - **Per-goal model pinning.** `GoalSpec.workerModel` overrides
102
+ routing rules + `cfg.gemini.model` for every tick of the run.
103
+ Set via the worker-model picker; saved into `goal.json` so the
104
+ pin survives restarts.
105
+ - **End-of-session summarizer.** New `[session]` config section
106
+ (`summarize_on_end`, `tier`, `min_turns`). On `/exit` / Ctrl-C /
107
+ `/quit` (or via the `/session summarize` slash command), the
108
+ REPL reads back the session's JSONL turns, asks the model for
109
+ durable signal in four buckets (`context` / `decisions` /
110
+ `requirements` / `soul updates`), and appends each non-empty
111
+ bucket to its target file: `memory/projects/<p>/{context,
112
+ decisions, requirements}.md` and the global
113
+ `<flowHome>/.flow/soul.md` (under a per-project section).
114
+ Resolves the long-standing "soul-keeper sees 0 bullets" symptom
115
+ — once `context.md` has content, soul-keeper's distillation
116
+ loop has work to do. Skipped for sessions shorter than
117
+ `min_turns` (default 3) so trivial lookups don't churn pro for
118
+ nothing.
119
+ - **Streaming everything.** Plan generation, speckit phases
120
+ (specify / plan / clarify / tasks), advisor side-calls, and the
121
+ session summarizer all use `chatStreamJson` with text-delta
122
+ forwarding. The loader modals render the model's output live —
123
+ no more frozen spinner.
124
+ - **Tier-aware routing primitive promoted.** `pickRoutedModel` and
125
+ the new `pickByTier` live in a shared `routing.ts` module
126
+ (extracted from `commands/goal.ts`). `GeminiClient` accepts an
127
+ optional `routingRules` config + per-call `tier` option;
128
+ `chosenModel(opts)` resolves model name without spawning. Four
129
+ call sites tagged with intent: `profile-recommend` (fast),
130
+ `App.tsx` free-form chat (fast), `plan-generation` (smart, when
131
+ used as a one-shot fallback), `agent-generate` (smart). The
132
+ remaining 8 hardcoded sites (squad helpers, debug, cve, etc.)
133
+ are flagged for a follow-up.
134
+ - **Lazy memoised model probe.** `model-probe.ts` resolves the
135
+ fast / smart / cheap models per (account, flowHome) and caches
136
+ the result at `~/.config/agenit/model-cache.json` with a 7-day
137
+ TTL. New `--reprobe` flag busts the cache after a Gemini-CLI
138
+ upgrade or account switch.
139
+ - **`/session` slash command.** `/session` shows status (id,
140
+ file, turns); `/session summarize` triggers the summarizer
141
+ manually mid-session.
142
+ - **`/goal output [<turn>]` and `/goal advisor [<turn>]`.** Both
143
+ print stored per-turn artefacts (full assistant response or
144
+ advisor reply) so users can audit what the agent saw at any
145
+ step.
146
+ - **Goal driver liveness updates.** During a streaming Gemini
147
+ call, the driver throttle-pushes "thinking …" snippets to the
148
+ rail card every ~1.5s. Card no longer goes stale (`?` glyph)
149
+ during long ticks; it shows actual text from the model.
150
+ - **JobDetailPanel "Advisor consults" section.** Lists every
151
+ consult by turn number, with a hint pointing at `/goal advisor
152
+ <N>` for the body.
153
+ - ~50 new tests across routing, model probe, advisor marker /
154
+ redaction / parser, prompt injection, session summary parse and
155
+ apply, clarify question parser, layout solver, and pool
156
+ snapshot fidelity. Total: 510 (up from 462 at 1.0.5).
157
+
158
+ ### Fixed
159
+
160
+ - **Card "stale" override during ticking.** The right-rail card
161
+ was rendering the `?` (stale) glyph during legitimate long
162
+ Gemini calls because `now - lastEventAt > 60s` triggered even
163
+ while the model was actively producing tokens. Stale now only
164
+ applies to `active` / `blocked` states — `ticking` is exempt
165
+ and shows the spinner instead.
166
+ - **Card width math.** Card content was overflowing because
167
+ `paddingX={1}` (2 cols) wasn't being subtracted from the
168
+ computed `innerWidth`. Fixed; "0s ago" no longer renders as "s
169
+ ago" with the leading character clipped.
170
+ - **Plan-loader frozen spinner.** Plan generation used
171
+ `gemini.chat()` (blocking text mode) — the user stared at a
172
+ spinner for the entire 20-60s pro call. Now uses
173
+ `chatStreamJson` with deltas forwarded into the modal buffer.
174
+ - **Speckit-clarify file detection.** The pipeline expected a
175
+ separate `clarification.md` file but speckit-clarify writes
176
+ back to `spec.md`. The detector now checks for a
177
+ `## Clarifications` section or moved mtime instead.
178
+
179
+ ### Changed
180
+
181
+ - **`Session.end()` no longer just writes a meta marker.** When
182
+ `[session] summarize_on_end` is true and the session has enough
183
+ turns, exit prompts the user to run the summarizer first.
184
+ - **`GoalSpec` schema additions** — `plan`, `workerModel`,
185
+ `speckitFid`, `tasksPath`, `tasksBody`, `advisorConsultCount`,
186
+ `lastAdvisorReply`. All optional; on-disk goal.json from 1.0.5
187
+ loads without changes.
188
+ - **`CostEntry` gains optional `kind: "tick" | "advisor"`** so
189
+ `costs.json` can attribute advisor consults separately while
190
+ keeping the integer turn key.
191
+ - **Plan persistence path** — when speckit runs, the plan lives
192
+ at `<project>/.specify/specs/<fid>/plan.md`. Approval modal
193
+ reads from there and the `[E]dit` action drops into `$EDITOR`
194
+ on that file directly (no sidecar copy). One-shot
195
+ `generatePlan` still writes to `.agenit-plans/` as a fallback
196
+ when speckit isn't used.
197
+
198
+ ### Out of scope (follow-ups)
199
+
200
+ - True interactive Q&A passed through to a single `speckit-clarify`
201
+ skill call (the two-pass approach replaces that pattern).
202
+ - Tagging the remaining 8 hardcoded model call sites
203
+ (squad helpers, debug, cve, stages, print-mode, speckit-internal,
204
+ etc.).
205
+ - Auto-summarizer that walks every session JSONL in
206
+ `.flow/sessions/` for a one-time backfill on long-lived projects.
207
+ - `/speckit chain <feature>` non-interactive variant for scripted
208
+ pipelines.
209
+
210
+ ## [1.0.5] - 2026-05-08
211
+
212
+ ### Added
213
+
214
+ - **Background-jobs dashboard.** A new right-rail in the REPL shows
215
+ one card per active background worker (autonomous goal runner,
216
+ soul-keeper, future scanners). Each card surfaces the worker's
217
+ state (`active` / `ticking` / `blocked` / `done` / `aborted`),
218
+ progress (`12/50 turns`, `7 bullets`), last event, and age.
219
+ Width-adaptive: wide rail at ≥140 cols, narrow at 120-139, single
220
+ horizontal strip at 100-119, hidden below 80 (jobs reachable via
221
+ the new `/jobs` command).
222
+ - **New `/jobs` slash command.** Lists / inspects / stops background
223
+ jobs. `/jobs` lists all, `/jobs <id>` shows detail, `/jobs stop <id>`
224
+ stops a pool worker. Goal runners route to `/goal stop` per the
225
+ existing API.
226
+ - **Init verification.** `/init` now finishes with a verification
227
+ step that confirms (a) skills directory non-empty, (b)
228
+ `.gemini/settings.json` valid JSON with all hook paths resolvable,
229
+ (c) `AGENTS.md` present, (d) Gemini-CLI binary works, and (e)
230
+ `gemini skills list` reports the seeded skills including a
231
+ sentinel name (proves end-to-end discovery, not just file
232
+ presence). Output uses `✓ / ✗ / -` icons with `↳ fix:` hints on
233
+ failure. `--no-verify` skips the step.
234
+ - **`JobSnapshot` + pool snapshot API.** `LoopWorker.snapshot()`,
235
+ `LoopWorkerHandle.getSnapshot()`, and `LoopWorkerPool.onChange()`
236
+ let any worker publish rich card data to the bus without coupling
237
+ to UI code. The TUI bus republishes pool spawns/evicts to the
238
+ rail automatically.
239
+ - 31 new tests covering job-layout solver, TUI bus batching, pool
240
+ snapshots, goal-snapshot mapping, init-verify checks, and
241
+ hook-path rewrites.
242
+
243
+ ### Fixed
244
+
245
+ - **`/goal start` no longer spins on empty model output.** Four
246
+ intertwined bugs that caused goal runs to log dozens of zero-work
247
+ turns:
248
+ - The auditor ran `git status --porcelain` against
249
+ `cfg.flow.flowHome` (the install root) instead of the user's
250
+ project directory. It now uses `cfg.gemini.workingDir`, the
251
+ same directory the spawned Gemini-CLI subprocess writes to.
252
+ - When the user's project wasn't a git repo, the auditor
253
+ silently reported zero file changes. `/goal tick` and
254
+ `/goal start` now run `git init --quiet` if `.git/` is
255
+ missing.
256
+ - The Gemini stream-json parser silently dropped responses when
257
+ the CLI used the newer `{type:"content", text:"..."}` event
258
+ shape instead of the older `{type:"message", role:"assistant",
259
+ delta:true, content:"..."}`. Both shapes are now accepted.
260
+ Empty responses on clean exit (auth errors, schema drift) now
261
+ throw an error including stderr + a stdout sample, instead of
262
+ looping indefinitely.
263
+ - `/goal status` reported `runner: running` after the autonomous
264
+ loop had exited on its own (completion / budget exhaustion /
265
+ error). The `activeRunner` reference now nulls itself when the
266
+ `stopped` event fires.
267
+ - **Stale relative hook paths in existing `settings.json` are now
268
+ refreshed.** A user who ran `/init` before the 1.0.4 path-rewriter
269
+ shipped had `./.flow/hooks/foo.py` tokens that fail at hook-fire
270
+ time because the user's project doesn't ship `.flow/hooks/`.
271
+ Re-running `/init` now re-rewrites those tokens to absolute paths
272
+ under flowHome while preserving any user customisations elsewhere
273
+ in the file. The fix is idempotent and only writes when something
274
+ actually changed.
275
+ - Backend errors during a goal tick (auth failures, model rejections)
276
+ now write an audit row with the error in `note` + `errors[]`,
277
+ mark the goal `Aborted`, and stop the runner cleanly. Previously
278
+ the runner could die without trace.
279
+
280
+ ### Changed
281
+
282
+ - `LoopWorkerHandle.done()` and `.stop()` now resolve only after
283
+ pool eviction completes — `pool.list()` is consistent with
284
+ `await handle.done()`.
285
+ - `tuiBus` updates are coalesced via microtask flush so producers
286
+ firing many concurrent `setJob()` calls cause one re-render per
287
+ event-loop tick instead of strobing the rail. `flushSync()` is
288
+ exposed for deterministic tests.
289
+ - `tuiBus.setJob()` and `removeJob()` now allocate a fresh
290
+ `backgroundJobs` array on every change so React's referential
291
+ equality fires for memoised consumers.
292
+
6
293
  ## [1.0.4] - 2026-05-08
7
294
 
8
295
  ### Added
package/README.md CHANGED
@@ -39,9 +39,9 @@ agenit run
39
39
  ## Commands
40
40
 
41
41
  | Command | Description |
42
- |---|---|
42
+ | --- | --- |
43
43
  | `agenit` | Interactive REPL |
44
- | `agenit init [dir]` | Scaffold project memory and `.agenit_project` marker |
44
+ | `agenit init [dir]` | Scaffold project memory + `.gemini/` assets + `.agenit_project` marker. Verifies Gemini-CLI can see the seeded skills before returning. Pass `--no-verify` to skip. |
45
45
  | `agenit run` | Run the full V-Model pipeline |
46
46
  | `agenit audit` | Show traceability registry |
47
47
  | `agenit projects` | List all projects in memory |
@@ -49,6 +49,14 @@ agenit run
49
49
  | `agenit sessions` | List recent sessions |
50
50
  | `agenit completions <shell>` | Print shell completion script (bash / zsh / fish) |
51
51
 
52
+ Selected REPL slash commands (full list in `/help`):
53
+
54
+ | Command | Description |
55
+ | --- | --- |
56
+ | `/goal <objective>` | Codex-style autonomous loop. `/goal start` runs ticks back-to-back; the right-rail card shows turn budget + last decision live. |
57
+ | `/jobs` | List active background jobs (goal runner, soul-keeper, scanners). Useful when the terminal is too narrow for the right-rail. |
58
+ | `/init` | Re-seed `.gemini/` skills + settings; verifies Gemini-CLI can see the result. |
59
+
52
60
  ## Configuration
53
61
 
54
62
  Place a `flow.toml` (or `agenit.toml`) in your project root, or pass `--config <path>`. See the [project documentation](https://github.com/muhammed-eldabea/flow) for the full schema.