@agenit/cli 1.1.0 → 1.3.4

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 (4) hide show
  1. package/CHANGELOG.md +389 -0
  2. package/cli.js +4003 -1913
  3. package/config/flow.toml +396 -0
  4. package/package.json +6 -4
@@ -0,0 +1,396 @@
1
+ [gemini]
2
+ # Gemini CLI binary. Use a bare name to let agenIT resolve it via PATH
3
+ # (cross-platform: searches PATH, then well-known install locations like
4
+ # /opt/homebrew/bin on macOS, /usr/local/bin on Linux, %APPDATA%\npm on
5
+ # Windows). Set an absolute path only if you need to pin a specific install.
6
+ binary = "gemini"
7
+ # Model override — leave commented out to use Gemini CLI's own default
8
+ # model = "gemini-2.5-pro"
9
+ # Working dir handed to the spawned Gemini-CLI as cwd. Resolved against the
10
+ # directory the user invoked `agenit` from (NOT the directory holding this
11
+ # file). Leave unset (or "." ) to follow the user's project — every
12
+ # `write_file` from Gemini then lands inside the project. Set to an absolute
13
+ # path only if you want all projects to share one workspace.
14
+ # working_dir = "."
15
+
16
+ [tools]
17
+ # Use the project venv so all tool dependencies (pdfplumber, cantools, etc.) are available
18
+ python = "/Users/mohamedeldabaa/TheFlow/.venv/bin/python3"
19
+ tools_dir = "../.flow/tools"
20
+
21
+ [jlink]
22
+ # Set per project: e.g. "STM32F407VG", "S32K144", "nRF52840_xxAA"
23
+ device = ""
24
+ interface = "SWD"
25
+ speed_khz = 4000
26
+
27
+ [flow]
28
+ # TheFlow installation root — auto-detected from binary; override with FLOW_HOME env var
29
+ flow_home = ".."
30
+ # All assets live under .flow/ (centralised)
31
+ soul_path = "../.flow/soul.md"
32
+ prompts_dir = "../.flow/prompts"
33
+ templates_dir = "../.flow/templates"
34
+ # Memory + codedigest are project-scoped: the orchestrator resolves these
35
+ # relative to the directory the user invoked `agenit` from, so each
36
+ # project owns its own `memory/` and `memory/codedigest/`. Use plain
37
+ # names (no leading `../`) so artefacts land *inside* the project.
38
+ memory_dir = "memory/projects"
39
+ codedigest_dir = "memory/codedigest"
40
+
41
+ # ─── Backend ─────────────────────────────────────────────────────────────────
42
+ # Selects which LLM provider the free-text REPL path and `/squad`'s
43
+ # primary-agent auto-fire use. V-Model nodes (`/swe1`/`/swe2`/`/swe4`/`/swe5`)
44
+ # always use the Gemini CLI directly. All squad helpers (the parallel
45
+ # fleet) also always use Gemini — see [squad] below for tier routing.
46
+ [backend]
47
+ # Accepted values: "gemini-cli" (default), "claude", "openai", "ollama".
48
+ # Each provider has its own auth requirement:
49
+ # gemini-cli — Google OAuth (no API key); requires the gemini binary above.
50
+ # claude — export ANTHROPIC_API_KEY.
51
+ # openai — export OPENAI_API_KEY.
52
+ # ollama — local daemon at http://localhost:11434 (override via OLLAMA_HOST).
53
+ provider = "gemini-cli"
54
+ # model = "claude-opus-4-7" # claude
55
+ # model = "gpt-4o-mini" # openai
56
+ # model = "llama3.2" # ollama
57
+ # model = "gemini-2.5-pro" # gemini-cli
58
+
59
+ # ─── Web tools — vendor docs, GitHub refs, RFCs ─────────────────────────────
60
+ # Backs `web_fetch.py` and `web_search.py` invoked by swe1 / swe2 / debug
61
+ # system prompts. The fetch sidecar enforces `allowed_domains` on every
62
+ # call (fnmatch-style; `*.example.com` matches subdomains, not the apex).
63
+ # Empty list → web fetch refuses every call (and the tool block is omitted
64
+ # from system prompts entirely so the LLM doesn't dangle a useless tool).
65
+ [web]
66
+ allowed_domains = [
67
+ "github.com",
68
+ "raw.githubusercontent.com",
69
+ "*.readthedocs.io",
70
+ "docs.python.org",
71
+ "*.st.com",
72
+ "*.nxp.com",
73
+ "*.nordicsemi.com",
74
+ "*.infineon.com",
75
+ "*.ti.com",
76
+ "*.microchip.com",
77
+ "*.renesas.com",
78
+ "*.espressif.com",
79
+ "developer.arm.com",
80
+ ]
81
+ search_provider = "duckduckgo" # PR-2: "brave" | "tavily"
82
+ search_api_key_env = "" # env var name carrying the API key (brave/tavily only)
83
+ fetch_timeout_secs = 10
84
+ fetch_max_bytes = 65536
85
+
86
+ # ─── Language Server Protocol (code intelligence) ────────────────────────────
87
+ # Backs `/lsp` and the LSP tool block injected into swe4-implementer / debug
88
+ # system prompts. Servers are auto-selected by file extension. Binaries are
89
+ # resolved in this order:
90
+ # 1. env var (FLOW_CLANGD / FLOW_PYRIGHT / FLOW_RUST_ANALYZER)
91
+ # 2. the value below
92
+ # 3. PATH lookup of the bare name
93
+ #
94
+ # clangd needs `compile_commands.json` somewhere above the queried file;
95
+ # generate one with CMake (CMAKE_EXPORT_COMPILE_COMMANDS=ON), `bear -- make`,
96
+ # or Bazel's hedron_compile_commands. The tool prints a friendly fix-it
97
+ # message if it's missing.
98
+ [lsp]
99
+ clangd_binary = "clangd"
100
+ pyright_binary = "pyright-langserver"
101
+ rust_analyzer_binary = "rust-analyzer"
102
+ compile_commands_dir = "." # relative to flow_home (this file's dir)
103
+ mode = "spawn" # PR-1: spawn-per-query; "daemon" lands in PR-2
104
+ query_timeout_secs = 15
105
+
106
+ # ─── Mission Squad ───────────────────────────────────────────────────────────
107
+ # Parallel helper-agent orchestration. `/squad <template> <task>` fans out
108
+ # a fleet of focused helpers across phases, then auto-fires the template's
109
+ # primary skill agent with the assembled briefing pre-injected.
110
+ [squad]
111
+ # Auto-run a matching squad template before each V-Model stage
112
+ # (`/swe1` / `/swe2` / `/swe4` / `/swe5`). Default off so existing flows
113
+ # keep their previous behaviour.
114
+ auto_squad = false
115
+
116
+ # Auto-fire the primary skill agent at the end of `/squad <…>`. Set to
117
+ # false to revert to briefing-only output (user copy-pastes manually).
118
+ auto_chain = true
119
+
120
+ # Per-helper wall-clock budget for *worker-tier* helpers (req-reader,
121
+ # code-scanner, trace-analyzer, etc., plus AgentTier::Worker LLM
122
+ # helpers). Cheap file-readers still finish in <100ms — the upper
123
+ # bound only kicks in when something is legitimately slow (large
124
+ # LLM call, fastembed first-run model download).
125
+ helper_timeout_secs = 90
126
+
127
+ # Per-helper wall-clock budget for *planner-tier* reducers / queens.
128
+ # Defaults to 3 × helper_timeout_secs when omitted (see #42 — the
129
+ # planner needs longer than a worker because it synthesises across
130
+ # every worker's briefing). Override here when running on slower
131
+ # hardware or with very long context windows.
132
+ # helper_timeout_planner_secs = 270
133
+
134
+ # Hard cap on the *total* number of helpers per squad (across phases).
135
+ max_helpers = 8
136
+
137
+ # Hard cap on the number of `gemini --prompt` subprocesses alive at the
138
+ # same instant — memory pressure brake. 4 × ~300 MB ≈ 1.2 GB worst case.
139
+ max_concurrent_agents = 4
140
+
141
+ # Gemini model for AgentTier::Worker slots — fast, cheap, many in parallel.
142
+ worker_model = "gemini-2.0-flash"
143
+
144
+ # Gemini model for AgentTier::Planner slots — smart, slower, usually one.
145
+ # All synthesisers (Phase 3 of every template) are Planner tier.
146
+ planner_model = "gemini-2.5-pro"
147
+
148
+ # Advise mode — when true, every agent prompt gains a non-strippable prefix
149
+ # instructing it to recommend rather than execute (no file mutation, no
150
+ # destructive shell). Useful for "reason but don't act" sessions.
151
+ advise_mode = false
152
+
153
+ # Reducer model for hierarchy queens and mesh reducers. Empty = inherit
154
+ # `planner_model`. Hierarchy/Mesh topologies emit a single Planner-tier
155
+ # call at the end of the run, so this knob lets you upgrade just that
156
+ # call (e.g. opus-4.7 reducer with flash workers).
157
+ reducer_model = ""
158
+
159
+ # ─── Topology-aware orchestration (Phase 1 of ruflo gap-closure) ────────────
160
+ # Controls how /squad and /orchestrate arrange helpers. `star` reproduces
161
+ # today's phased fan-out exactly. `pipeline` chains helpers serially.
162
+ # `hierarchy` plans + reduces via a Planner-tier queen. `mesh` votes
163
+ # across worker briefings via a consensus reducer.
164
+ [orchestrate]
165
+ # Default coordination shape when /squad and /orchestrate omit
166
+ # --topology=<t>. Values: "star" | "pipeline" | "hierarchy" | "mesh".
167
+ default_topology = "star"
168
+ # When true, /goal tick prepends a small star-topology squad to refresh
169
+ # context (req-reader, codedigest-searcher, session-memory) before the
170
+ # LLM call. Default off — goal stays a single-agent loop.
171
+ pre_tick_squad = false
172
+ # Hard cap on helpers a non-star topology may spawn. Mesh fan-out is
173
+ # quadratic so a runaway plan needs an explicit ceiling.
174
+ max_topology_helpers = 12
175
+
176
+ [telemetry]
177
+ # OpenTelemetry exporter — "none" (default; zero overhead),
178
+ # "stdout" (one-line per span on stderr; useful for `flow --debug` runs),
179
+ # "console" (verbose upstream ConsoleSpanExporter), or
180
+ # "otlp" (batched OTLP/HTTP to `otlp_endpoint`).
181
+ exporter = "none"
182
+
183
+ # OTLP/HTTP endpoint — only used when exporter = "otlp".
184
+ # Examples:
185
+ # - http://localhost:4318/v1/traces (Jaeger / OTel collector)
186
+ # - https://otlp.honeycomb.io/v1/traces (Honeycomb)
187
+ otlp_endpoint = ""
188
+
189
+ # Resource attribute reported on every span. Override per-machine if you
190
+ # want to distinguish hosts in your trace backend.
191
+ service_name = "flow"
192
+
193
+ [update_check]
194
+ # When true, the REPL polls https://registry.npmjs.org once per 24 h
195
+ # (cached at ~/.cache/flow/version-check.json) and prints a one-line
196
+ # notice if a newer version of `npm_package` is available. Set
197
+ # `npm_package` to the published name once the first release tag is
198
+ # cut; leave empty to disable until then. See
199
+ # docs/opencode-parity-followups.md A9 for the npm-name decision.
200
+ enabled = true
201
+ npm_package = "@agenit/cli"
202
+
203
+ [security]
204
+ # Whitelist of binary names allowed as the first token of any
205
+ # `run_shell_command` invocation. The BeforeTool guard hook denies
206
+ # anything else with a friendly message. Empty list disables the check
207
+ # (default), so existing setups keep working until you opt in.
208
+ #
209
+ # Recommended starter set for embedded engineers:
210
+ # allowed_shell = ["git", "make", "cmake", "ninja", "pnpm", "npm",
211
+ # "python3", "pytest", "cargo", "rustc", "clang",
212
+ # "gcc", "ls", "cat", "head", "tail", "grep", "find",
213
+ # "rg", "diff", "patch", "JLinkExe", "openocd"]
214
+ allowed_shell = []
215
+
216
+ # ─── Compliance modes (Phase 2 of ruflo gap-closure) ────────────────────────
217
+ # Drives the AIDefence prompt-injection / PII guard and the BeforeTool
218
+ # tool denylist. Pick the strictest mode that matches your data
219
+ # classification — modes auto-enable the hash-chain audit log unless
220
+ # `audit_log_enabled` is set explicitly below.
221
+ #
222
+ # "off" — no extra restrictions (default; today's behaviour).
223
+ # "soc2" — warn-only PII; every BeforeTool call appends to audit.log.
224
+ # "gdpr" — PII redacted from prompts; audit log enabled.
225
+ # "hipaa" — PII denies the prompt outright; web_fetch / google_web_search /
226
+ # run_shell_command are forbidden; audit log enabled.
227
+ compliance_mode = "off"
228
+
229
+ # Optional subset of PII categories the AIDefence scanner should check.
230
+ # Empty = all 14 (email, phone_us, phone_intl, ssn_us, credit_card,
231
+ # iban, ip_v4, ip_v6, mac_address, aws_access_key, aws_secret_key,
232
+ # private_key_block, github_pat, jwt). Set to a subset if scan latency
233
+ # is a concern (the scanner is ~5MB/s but ~80ms on very large prompts).
234
+ pii_categories = []
235
+
236
+ # Tamper-evident audit log. When enabled, every BeforeTool fire appends
237
+ # a SHA-256 chained record to `<memory_dir>/audit.log` so any tampering
238
+ # breaks every subsequent hash. Auto-enabled by compliance_mode != "off".
239
+ # audit_log_enabled = true
240
+
241
+ [modes.plan]
242
+ # Tool names allowed while `/plan` mode is active. The default set
243
+ # (read_file, list_directory, glob, search_file_content,
244
+ # google_web_search, web_fetch) keeps research workflows fluid while
245
+ # blocking writes. Override here if you want, e.g., to allow
246
+ # `apply_patch` for review-style edits.
247
+ # allowed_tools = ["read_file", "search_file_content", "list_directory"]
248
+
249
+ [modes.build]
250
+ # Empty = unrestricted (default). Useful if you want to forbid certain
251
+ # tools globally (e.g. in a CI sandbox).
252
+ # allowed_tools = []
253
+
254
+ [codedigest]
255
+ # When true, the REPL launches a chokidar watcher that auto-reindexes
256
+ # the codedigest store on source-file changes. Burst saves are
257
+ # coalesced into one rebuild via debounce_ms; cooldown_ms is the hard
258
+ # floor between successive rebuilds. Default is false to preserve
259
+ # pre-B3 behaviour (explicit `/codedigest index`).
260
+ auto_reindex = false
261
+ debounce_ms = 2000
262
+ cooldown_ms = 30000
263
+
264
+ # ─── mempalace — semantic memory retrieval (opt-in) ────────────────────────
265
+ # Hybrid retrieval over `memory/projects/<project>/{context,decisions,
266
+ # requirements}.md`. Markdown stays the source of truth; mempalace is the
267
+ # optional accelerator. When `enabled = false` (default), `/req` and `/arch`
268
+ # stages run identically to today and `/mempalace` prints a one-liner pointing
269
+ # at doc/integrations/mempalace.md. Install with `pip install mempalace`.
270
+ #
271
+ # Override the master switch at runtime with the AGENIT_MEMPALACE env var
272
+ # ("1"/"true" → on; "0"/"false" → off; anything else falls through to this
273
+ # config).
274
+ [mempalace]
275
+ enabled = false
276
+ # Binary name or absolute path. Resolved against PATH when bare.
277
+ binary = "mempalace"
278
+ # Palace root. The orchestrator reads this verbatim; users who want
279
+ # project-scoped palaces can use a path like "memory/mempalace/<project>"
280
+ # and run `mempalace init` per project.
281
+ palace_dir = "memory/mempalace"
282
+ # Hits returned per `mempalace search` invocation. The retrieved snippets
283
+ # are injected verbatim into the model's context, so keep this small.
284
+ top_k = 5
285
+ # Hard cap on a single mempalace invocation in seconds.
286
+ query_timeout_secs = 5
287
+
288
+ # ─── Memory backend (Phase 3 of ruflo gap-closure) ──────────────────────────
289
+ # Pluggable memory + search drivers. Default "bm25" preserves today's
290
+ # behaviour exactly. Dense backends are lazy-loaded, so picking
291
+ # anything other than bm25 only pays the install cost on first use.
292
+ #
293
+ # "bm25" — keyword + name-boost (default; zero deps).
294
+ # "xenova" — @xenova/transformers MiniLM-L6-v2 embeddings;
295
+ # ~80MB install on first load. Pure Node.
296
+ # "python" — shells out to .flow/tools/embed_search.py
297
+ # (sentence-transformers + faiss); requires Python venv.
298
+ # "mempalace" — reuses the [mempalace] integration above.
299
+ # "hybrid" — combines BM25 with the configured dense driver.
300
+ [memory]
301
+ backend = "bm25"
302
+
303
+ # When backend = "hybrid", which dense driver to combine with BM25.
304
+ # Values: "xenova" | "python" | "mempalace".
305
+ hybrid_dense = "xenova"
306
+
307
+ # Weight on the BM25 side of the hybrid score (0..1). 0 = pure dense,
308
+ # 1 = pure BM25. Default 0.5.
309
+ hybrid_alpha = 0.5
310
+
311
+ # Python sidecar path + timeout (only used when backend = "python" or
312
+ # hybrid + hybrid_dense = "python").
313
+ python_tool_path = ".flow/tools/embed_search.py"
314
+ python_timeout_ms = 60000
315
+
316
+ # Soul-keeper background worker — distils repeated bullets in
317
+ # `memory/projects/<p>/context.md` into the User Profile section of
318
+ # `.flow/soul.md`. Wired into session start in cli.tsx; runs forever
319
+ # at `soul_keeper_gap_ms` cadence. Set `soul_keeper_enabled = false`
320
+ # on noisy projects where you don't want auto-promotion.
321
+ soul_keeper_enabled = true
322
+ soul_keeper_gap_ms = 300000 # 5 minutes (300_000 ms)
323
+
324
+ # ReasoningBank — append-only "task pattern → outcome" tuples written
325
+ # at goal completion and surfaced to future squads.
326
+ reasoning_dir = "memory/reasoning"
327
+ reasoning_on_goal_complete = true
328
+
329
+ # RVF — cross-session goal snapshots so other sessions / machines can
330
+ # retrieve a goal's outcome without re-running it.
331
+ rvf_dir = "memory/rvf"
332
+ rvf_on_goal_complete = true
333
+
334
+ # ─── Routing & cost (Phase 4 of ruflo gap-closure) ──────────────────────────
335
+ # Per-task-tier model preference and a per-turn cost ceiling. Each rule
336
+ # maps a tier ("fast" / "smart" / "cheap") to a (provider, model) pair.
337
+ # Tagged call sites (profile-recommend → fast, plan-generation → smart,
338
+ # agent-generate → smart, REPL chat → fast) and the goal driver consult
339
+ # this map to pick the right model. The runtime probe at first run will
340
+ # adjust the model strings if the canonical names below aren't available
341
+ # on your install — see `agenit --reprobe` to bust the cache.
342
+ [routing]
343
+ rules = [
344
+ { tier = "fast", provider = "gemini-cli", model = "gemini-2.5-flash" },
345
+ { tier = "smart", provider = "gemini-cli", model = "gemini-2.5-pro" },
346
+ { tier = "cheap", provider = "gemini-cli", model = "gemini-2.5-flash" },
347
+ ]
348
+ # Multi-provider example (mix vendors per tier):
349
+ # rules = [
350
+ # { tier = "cheap", provider = "openai", model = "gpt-4o-mini" },
351
+ # { tier = "fast", provider = "gemini-cli", model = "gemini-2.5-flash" },
352
+ # { tier = "smart", provider = "claude", model = "claude-opus-4-7" },
353
+ # ]
354
+
355
+ # Hard cap on USD per turn. 0 disables. When a turn's cost exceeds
356
+ # this, the goal short-circuits with budget_exhausted.
357
+ max_cost_per_turn_usd = 0
358
+
359
+ # Per-model rate overrides ($/1k tokens). Falls through to the
360
+ # defaults in @flow/goal's DEFAULT_RATE_USD_PER_1K_TOKENS table.
361
+ # rate_overrides_usd_per_1k_tokens = { "gemini-2.5-pro" = 0.0035 }
362
+
363
+ # ─── Advisor ────────────────────────────────────────────────────────────────
364
+ # Marker-driven advisor side-call. When the goal driver's main model
365
+ # emits `[[ADVISOR: <question>]]` in its tick response, the orchestrator
366
+ # pauses, runs a side-call to a smarter model with full context, and
367
+ # injects the reply into the next turn's prompt under "## Advisor reply".
368
+ # Designed for setups where the main loop runs on flash (cheap, fast)
369
+ # and only consults pro when it actually needs deeper reasoning.
370
+ [advisor]
371
+ enabled = true
372
+ # Tier the advisor consult runs at. "smart" → pro; drop to "fast"
373
+ # on free-tier setups.
374
+ tier = "smart"
375
+ # Hard cap on consults per goal. Prevents an over-eager flash run
376
+ # from 10×-ing token cost via repeated consults.
377
+ max_consults_per_goal = 5
378
+ # Replace absolute paths in audit-note context with `<path>` before
379
+ # sending to the advisor. Mitigates accidental filesystem disclosure.
380
+ redact_paths = true
381
+
382
+ # ─── Session summary ────────────────────────────────────────────────────────
383
+ # End-of-session LLM summarizer. Reads back the session's turns and
384
+ # extracts: durable project context, architecture decisions,
385
+ # requirements, and user-preference patterns. Outputs land in
386
+ # `memory/projects/<p>/{context,decisions,requirements}.md` (per
387
+ # project) and `<flow_home>/.flow/soul.md` (global). Without this
388
+ # step, soul-keeper has nothing to distill — context.md stays empty.
389
+ [session]
390
+ summarize_on_end = true
391
+ # Tier the summarizer runs at. "smart" → pro, tighter structured
392
+ # output; "fast" → flash, faster exit, slightly looser structure.
393
+ tier = "smart"
394
+ # Don't summarize sessions shorter than this — trivial sessions
395
+ # (lookup, /exit) don't yield durable signal.
396
+ min_turns = 3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenit/cli",
3
- "version": "1.1.0",
3
+ "version": "1.3.4",
4
4
  "description": "agenIT — Profile-driven AI dev co-pilot CLI (TypeScript / Ink). ASPICE-aligned V-Model workflow on top of Gemini CLI for embedded engineering teams.",
5
5
  "keywords": [
6
6
  "agenit",
@@ -18,14 +18,14 @@
18
18
  "typescript"
19
19
  ],
20
20
  "author": "Mohamed Eldabaa <mohamed.eldabaa@yahoo.com>",
21
- "homepage": "https://github.com/muhammed-eldabea/flow#readme",
21
+ "homepage": "https://github.com/muhammed-eldabea/AgenIT#readme",
22
22
  "bugs": {
23
- "url": "https://github.com/muhammed-eldabea/flow/issues"
23
+ "url": "https://github.com/muhammed-eldabea/AgenIT/issues"
24
24
  },
25
25
  "license": "MIT",
26
26
  "repository": {
27
27
  "type": "git",
28
- "url": "git+https://github.com/muhammed-eldabea/flow.git",
28
+ "url": "git+https://github.com/muhammed-eldabea/AgenIT.git",
29
29
  "directory": "packages/orchestrator"
30
30
  },
31
31
  "type": "module",
@@ -36,6 +36,7 @@
36
36
  "files": [
37
37
  "cli.js",
38
38
  "bin",
39
+ "config",
39
40
  "README.md",
40
41
  "CHANGELOG.md",
41
42
  "LICENSE"
@@ -47,6 +48,7 @@
47
48
  "access": "public"
48
49
  },
49
50
  "dependencies": {
51
+ "@google/gemini-cli": ">=0.37.0",
50
52
  "@iarna/toml": "^2.2.5",
51
53
  "@opentelemetry/api": "^1.9.0",
52
54
  "@opentelemetry/exporter-metrics-otlp-http": "^0.57.0",