snipara-companion 2.0.6 → 2.0.7

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/README.md CHANGED
@@ -1,1020 +1,102 @@
1
1
  # snipara-companion
2
2
 
3
- **Local helper CLI for Snipara agent workflows.**
3
+ **Ask your repo what breaks if you touch this.**
4
4
 
5
- `snipara-companion` adds Git-style continuity commands for agent work: status,
6
- briefs, timelines, phase commits, handoffs, resume, diagnostics, hooks, folder
7
- onboarding, local Mini Snipara bridges, and command-line access around Snipara
8
- Hosted MCP. It complements the hosted context and memory surface; it is not the
9
- primary runtime for agents.
10
-
11
- In this repository, the source currently lives in `packages/cli`, and the installed executable is `snipara-companion`.
12
-
13
- This package complements `snipara-mcp`. It does not replace it.
14
-
15
- ## Quickstart
5
+ No global install. No `init`. No account. Your code stays on your machine.
16
6
 
17
7
  ```bash
18
- # 1. Install
19
- npm install -g snipara-companion
20
-
21
- # 2. Point this workspace at a Snipara project (writes local .snipara/ config)
22
- snipara-companion init # interactive; or: snipara-companion login
23
-
24
- # 3. Use it in your agent workflow
25
- snipara-companion brief # what changed, why, impact, next action, safe-to-proceed
26
- snipara-companion status # current work across workflow, git, and Team Sync
27
- snipara-companion handoff --summary "<what changed>" --next "<next step>"
8
+ npx -y snipara-companion impact src/auth/session.ts --source local
28
9
  ```
29
10
 
30
- Local continuity commands work without a Snipara account; commands that read
31
- hosted context or memory need `init`/`login` first. Run
32
- `snipara-companion --help` for the full command list.
33
-
34
- ## Local Context Pack
35
-
36
- `context-pack` is a free, local-only reversible pack for long tool outputs,
37
- logs, diffs, and notes. It stores exact content under
38
- `.snipara/context-pack` and never uploads raw output to hosted Snipara.
11
+ Example output excerpt:
39
12
 
40
- ```bash
41
- # Pack piped tool output
42
- pnpm test 2>&1 | snipara-companion context-pack pack \
43
- --label "package test output" \
44
- --source "pnpm test"
45
-
46
- # Pack a local file
47
- snipara-companion context-pack pack --file ./debug.log --kind log --json
48
-
49
- # Retrieve exact content later
50
- snipara-companion context-pack retrieve latest
51
- snipara-companion context-pack retrieve cpack_abcd1234 --output ./restored.log
52
- snipara-companion context-pack retrieve cpack_abcd1234 --json --metadata-only
53
-
54
- # Inspect and clean local storage
55
- snipara-companion context-pack stats
56
- snipara-companion context-pack clean --older-than-days 14
13
+ ```text
14
+ Code impact - local - src/auth/session.ts
15
+ Source: local_overlay
16
+ Reason: source_forced_local
57
17
 
58
- # Attach metadata-only receipts to events/checkpoints
59
- snipara-companion post-tool --tool Bash --result "$(cat ./debug.log)" --pack-result
60
- snipara-companion emit-event -e tool_result --context-pack cpack_abcd1234
61
- snipara-companion workflow runtime-checkpoint verify \
62
- --summary "Captured verifier output" \
63
- --context-pack cpack_abcd1234
64
- ```
65
-
66
- The pack ID is derived from the content hash, so packing identical content is
67
- idempotent. Use `--ttl-days` when temporary output should be cleaned by the
68
- default `context-pack clean` path. The storage directory writes its own
69
- `.gitignore` so raw pack blobs do not appear in normal Git staging. Pack blobs
70
- are plaintext local files with restrictive permissions. Secret-like input is
71
- blocked by default; use `--allow-sensitive` only when you intentionally need an
72
- exact local recovery artifact, and prefer the exact pack ID over `latest` in
73
- handoffs.
18
+ Incoming (2) - files that depend on this
19
+ apps/web/src/lib/auth/permissions.ts
20
+ apps/web/src/app/api/auth/session/route.ts
74
21
 
75
- Metadata-only context-pack receipts include token economy fields:
76
- `baseline_tokens`, `packed_tokens`, `retrieved_tokens`, and `saved_tokens`.
77
- Pack/reference receipts can claim saved tokens because only receipt metadata is
78
- uploaded; retrieve receipts set retrieved tokens to the local baseline so they
79
- do not overstate savings.
22
+ Outgoing (2) - files this depends on
23
+ src/auth/cookies.ts
24
+ src/auth/tokens.ts
80
25
 
81
- ```mermaid
82
- flowchart LR
83
- Project["Local project"] --> Companion["snipara-companion"]
84
- Companion --> Diagnostics["status, brief, timeline, phase commits, handoff"]
85
- Companion --> Packs["context-pack (local output packs)"]
86
- Companion --> Memory["snipara-memory (optional local memory)"]
87
- Companion --> Evals["snipara-evals (optional local evals)"]
88
- Companion --> Hosted["Snipara Hosted MCP / API"]
89
- Hosted --> Agents["Codex, Claude Code, Cursor, ChatGPT"]
26
+ Use --json for full overlay details.
90
27
  ```
91
28
 
92
- ## Mini Snipara Open Stack
93
-
94
- `snipara-companion` is the local workflow layer in the open Mini Snipara stack:
95
-
96
- | Repo | Role | Account required |
97
- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | ---------------------------------------- |
98
- | [`snipara-companion`](https://github.com/Snipara/snipara-companion) | Local workflow continuity, hooks, handoffs, and hosted bridges | No for local state; yes for hosted calls |
99
- | [`snipara-memory`](https://github.com/Snipara/snipara-memory) | Local durable project memory engine and MCP/API wrapper | No |
100
- | [`snipara-evals`](https://github.com/Snipara/snipara-evals) | Deterministic Project Intelligence evals for handoffs, context, decisions, impact, verification, and continuity | No |
29
+ That first command is the product promise: run a local blast-radius check from
30
+ your current checkout in seconds, before an agent edits the wrong thing.
101
31
 
102
- Hosted Snipara remains the managed layer for source authority, reviewed memory,
103
- team-wide presence, shared claims/locks, conflict alarms, GitHub checks,
104
- dashboard live views, and Cloud code graph impact. Local commands are useful for
105
- single-machine continuity and CI artifacts, but they cannot prove what another
106
- human or agent is doing on a different machine unless the hosted collaboration
107
- backend is configured.
32
+ ## Free Local Surface
108
33
 
109
- ## Local vs Hosted Capabilities
34
+ These commands are useful without hosted Snipara:
110
35
 
111
- | Capability | Local/open stack | Hosted Snipara |
112
- | -------------------------------------------- | ---------------------------------- | ------------------------------------------- |
113
- | Workflow state, timeline, handoff files | Yes | Syncs and enriches when configured |
114
- | Local project memory | Via `snipara-memory` | Managed, reviewed, scoped memory |
115
- | Project Intelligence eval artifacts | Via `snipara-evals` | Can use hosted context/code graph as inputs |
116
- | Git hooks and local guards | Yes | Stronger with hosted guard decisions |
117
- | Presence across machines and agents | No | Yes |
118
- | Shared claims/locks and stale lease handling | Local only is advisory | Yes |
119
- | GitHub checks and dashboard live views | No | Yes |
120
- | Code graph impact and symbol cards | Local overlay only where available | Cloud code graph |
36
+ | Command | What it gives you locally |
37
+ | ------------------------------------------------------------ | ------------------------------------------------------------ |
38
+ | `impact` / `code impact` | File-level blast-radius from the local code overlay |
39
+ | `code callers` / `imports` / `neighbors` / `shortest-path` | Structural repo questions from local files |
40
+ | `workflow start` / `phase-start` / `phase-commit` / `resume` | Agent continuity that survives compaction |
41
+ | `context-pack` | Reversible local packs for long logs, diffs, and tool output |
42
+ | `judgment-card`, `verify`, `references` | Local review artifacts and source-backed references |
43
+ | `stuck-guard`, `memory-guard`, `pre-tool`, `post-tool` | Fail-soft local guards and hook helpers |
121
44
 
122
- ## When To Use It
45
+ ## Agent Continuity
123
46
 
124
- | If you need... | Install... |
125
- | --------------------------------------------------------- | ------------------------ |
126
- | MCP tools, OAuth login, project-scoped context and memory | `snipara-mcp` |
127
- | One-command Hosted MCP + companion setup | `create-snipara` |
128
- | Git-style local continuity, workflow modes, and hooks | `snipara-companion` |
129
- | Production gates, drift checks, and htask orchestration | `snipara-orchestrator` |
130
- | OpenClaw-specific automation hooks | `snipara-openclaw-hooks` |
131
-
132
- ### Codex Note
133
-
134
- For Codex, the primary integration remains Hosted MCP plus `AGENTS.md`.
135
-
136
- - `create-snipara` installs `snipara-companion` by default for managed workflow commands.
137
- - `snipara-companion` is still skippable with `--profile hosted-only` or `--skip-companion`.
138
- - Use it when compaction-safe phase commits, Project Intelligence briefs, local doctor checks, or shared helper workflows are useful.
139
- - Use `workflow scaffold --preset project-intelligence-continuity-layer` for roadmap-sized Project Intelligence work that needs phase commits.
140
- - If an agent session exposes only a subset of Snipara tools, use `snipara_help(list_all=true)` in that session before concluding a tool is unavailable.
141
-
142
- ## Configuring MCP Tool Surfaces
143
-
144
- The MCP server advertises different tool surfaces depending on the `SNIPARA_EXPOSED_SURFACES` environment variable. Hosted MCP defaults to inline tools plus a small companion maintenance set for index health, reindexing, and read-only memory hygiene. To expose all companion tools directly in the advertised manifest, set `SNIPARA_EXPOSED_SURFACES=inline,companion` on the MCP server. To expose swarm and htask coordination tools, use `SNIPARA_EXPOSED_SURFACES=inline,orchestrator`. Remaining non-default tools are discoverable via `snipara_help` and can be executed by direct JSON-RPC or clients/server configurations that expose those surfaces. Standard MCP agents only receive schemas for tools returned by `tools/list`.
145
-
146
- ## Installation
47
+ After the first impact check, keep the work resumable:
147
48
 
148
49
  ```bash
149
- npm install -g snipara-companion
150
- # or
151
- pnpm add -g snipara-companion
152
- # or
153
- yarn global add snipara-companion
50
+ npx -y snipara-companion workflow start --goal "ship auth hardening"
51
+ npx -y snipara-companion workflow phase-start audit
52
+ npx -y snipara-companion workflow phase-commit audit --summary "mapped auth impact"
53
+ npx -y snipara-companion handoff --summary "auth impact mapped" --next "run auth tests"
154
54
  ```
155
55
 
156
- ## Installed Command
56
+ `snipara-companion` writes local state under `.snipara/` so a coding agent can
57
+ resume with the current phase, recent handoffs, timeline, context packs, and
58
+ verification hints.
157
59
 
158
- ```bash
159
- snipara-companion
160
- ```
161
-
162
- ## Changelog
163
-
164
- Release notes have moved to [CHANGELOG.md](./CHANGELOG.md).
165
-
166
- ## Agentic Work Commands
60
+ ## Local First, Hosted When Useful
167
61
 
168
- `create-snipara` gets the project connected. `snipara-companion` keeps long
169
- agent sessions resumable. Install once with `npx create-snipara`; continue every
170
- session with `snipara-companion`:
171
-
172
- ```bash
173
- snipara-companion status
174
- snipara-companion brief --task "ship auth hardening" --changed-files src/auth.ts
175
- snipara-companion timeline
176
- snipara-companion workflow phase-commit build --summary "tests green"
177
- snipara-companion workflow impact-gate
178
- snipara-companion workflow run --adaptive-routing-dry-run --route-local-workers "document a scoped change"
179
- snipara-companion verify --changed-files src/auth.ts --diff-summary "auth hardening"
180
- snipara-companion run --task "ship auth hardening" --changed-files src/auth.ts --release
181
- snipara-companion handoff --summary "status command shipped" --next "publish package"
182
- snipara-companion workflow resume --include-session-context
183
- ```
62
+ Local mode is first-class for one repo, one machine, and one session. Hosted
63
+ Snipara is the upgrade path for team and cross-project intelligence.
184
64
 
185
- - `status` is the Git-style local work status: workflow phase, latest phase
186
- commit, git dirtiness, Team Sync handoffs, local risks, and next action.
187
- - `brief` is the short alias for `intelligence brief`.
188
- - `timeline` is the Git-style log for workflow starts, phase starts, phase
189
- commits, final commits, and Team Sync handoffs.
190
- - `workflow impact-gate` audits committed local workflow phases that are ahead
191
- of upstream but not pushed. It does not push, and dirty working-tree files are
192
- reported separately from the committed diff.
193
- - `workflow run --adaptive-routing-dry-run` prints an Adaptive Work Routing
194
- card. Add `--route-local-workers` when a strong planner should keep deep
195
- reasoning while a local worker handles scoped execution.
196
- - `verify` builds a transparent verification plan from companion code impact
197
- signals plus local package scripts. It recommends checks; it does not claim to
198
- execute them.
199
- - `handoff` writes an agent-ready handoff artifact while persisting the same
200
- local/hosted Team Sync continuity record as `team-sync handoff`.
65
+ | Need | Local companion | Hosted Snipara |
66
+ | ----------------------------------------------- | ------------------------- | ----------------------------------- |
67
+ | Inspect this repo before editing | Yes, no account | Optional hosted code graph |
68
+ | Keep code private on this machine | Yes | Use only when explicitly configured |
69
+ | Preserve agent workflow state | Yes, `.snipara/` files | Syncs across machines and agents |
70
+ | Store/retrieve long tool output | Yes, `context-pack` | Metadata and receipts can be shared |
71
+ | Semantic project context and embeddings | Local docs/artifacts only | Managed context ranking |
72
+ | Reviewed memory and outcome calibration | Local artifacts only | Team memory and proof loop |
73
+ | Shared claims, locks, dashboards, GitHub checks | Local hints only | Team coordination and audit |
201
74
 
202
- The mental model is intentionally close to Git:
75
+ Use hosted mode when you want shared memory, semantic retrieval, cloud code
76
+ graph, cross-machine presence, outcome learning, team coordination, or dashboard
77
+ proof. Keep local mode when the question is simply: "what does this repo say
78
+ will break if I touch this file?"
203
79
 
204
- | Git habit | Companion command |
205
- | --------------------- | ----------------------------------------- |
206
- | `git status` | `snipara-companion status` |
207
- | `git show` | `snipara-companion brief` |
208
- | `git commit` | `snipara-companion workflow phase-commit` |
209
- | `git diff @{u}..HEAD` | `snipara-companion workflow impact-gate` |
210
- | `git log` | `snipara-companion timeline` |
211
- | `git format-patch` | `snipara-companion handoff` |
212
- | `git checkout` | `snipara-companion workflow resume` |
80
+ ## Install
213
81
 
214
- `snipara-companion final-commit` closes the local workflow and asks the hosted
215
- API only for the final Team Sync handoff. The CLI sends a compact summary with a
216
- longer timeout, retries once with a shorter summary on transient hosted failures,
217
- and then records a local fallback handoff in `.snipara/team-sync/session.json`
218
- if the hosted call still times out. A hosted final-commit timeout does not modify
219
- Git state. Custom final-commit categories are namespaced under `final-commit`
220
- before the hosted call so they stay on the handoff-only path.
221
-
222
- ## Adaptive Work Routing
223
-
224
- Adaptive Work Routing is a recommendation-first path for routing scoped work to
225
- the right worker class, endpoint type, and cost profile without hardcoding model
226
- names in the CLI.
227
-
228
- ```bash
229
- snipara-companion workflow run \
230
- --mode full \
231
- --adaptive-routing-dry-run \
232
- --route-local-workers \
233
- --routing-worker-role coding \
234
- --routing-preferred-endpoint local \
235
- --routing-allowed-endpoint local \
236
- --routing-allowed-endpoint cloud \
237
- --planner-retains-reasoning \
238
- "Update documentation for the new gateway"
239
- ```
240
-
241
- The output is a routing card and handoff metadata. Companion calls the hosted
242
- `snipara_adaptive_routing_catalog` tool when project auth and policy allow it,
243
- records the sanitized runtime catalog in the handoff, and falls back to local
244
- dry-run metadata when the hosted gateway is unavailable or omits
245
- `success: true`. It does not silently spawn workers. The stable contract is
246
- provider-neutral requirements such as worker role, reasoning depth, context
247
- budget, endpoint type, write scope, and fallback.
248
-
249
- Project owners can configure Adaptive Work Routing in Project > Automation:
250
- `off`, `recommend`, or `catalog`; approval; planner-retained reasoning; allowed
251
- endpoint types (`cloud`, `local`, `self_hosted`); worker classes; and budget
252
- hints. `workflow run` reads that hosted policy and CLI flags cannot broaden it.
253
- Companion passes policy budgets into provider-neutral model requirements; the
254
- hosted gateway enforces project and provider daily/monthly budgets when receipt
255
- history is available.
256
-
257
- Approval is an MCP contract, not a dashboard-only UX path. When project policy
258
- requires approval, a coding agent calls `snipara_adaptive_routing_approve` with
259
- the routing card or handoff subject, approved write scopes, endpoint types, a
260
- stable `idempotency_key`, and optional cost/expiry bounds. Companion dry-runs
261
- surface the approval requirement but do not auto-approve or spawn workers.
262
- Project credentials stay server-side behind the hosted gateway; local endpoints
263
- such as Ollama, LM Studio, AnythingLLM, or other OpenAI-compatible servers must
264
- be reachable from the worker execution environment.
265
-
266
- For the open package without Snipara SaaS, add a local policy file:
267
-
268
- ```json
269
- {
270
- "mode": "recommend",
271
- "plannerRetainsReasoning": true,
272
- "preferLocalWorkers": true,
273
- "allowedEndpointTypes": ["local", "cloud"],
274
- "preferredEndpointTypes": ["local"],
275
- "allowedWorkerClasses": ["documentation", "tests", "review"],
276
- "catalogLimit": 8
277
- }
278
- ```
279
-
280
- Save it at `.snipara/adaptive-routing.json`. Without hosted configuration,
281
- `workflow run` only emits local Adaptive Work Routing metadata and handoff files:
282
- it does not query hosted context, call the hosted catalog, or spawn workers.
283
-
284
- ## Verification Plans
285
-
286
- Use `verify` when an agent asks what to prove before handoff or release:
287
-
288
- ```bash
289
- snipara-companion verify --changed-files src/auth.ts tests/auth.test.ts --diff-summary "auth hardening"
290
- snipara-companion verify --file-path src/auth.ts --json
291
- snipara-companion verify --skip-impact --changed-files src/auth.ts
292
- ```
293
-
294
- Output includes:
295
-
296
- - recommended checks from code impact and local package scripts
297
- - impacted files
298
- - risk level and score when code impact is available
299
- - missing checks and caveats
300
- - suggested next commands
301
-
302
- ## Supported Client Presets Today
303
-
304
- The built-in `init` and `automations` flows share these client names:
305
-
306
- - `claude-code`
307
- - `cursor`
308
- - `windsurf`
309
- - `codex`
310
- - `gemini`
311
- - `mistral`
312
- - `chatgpt`
313
- - `vscode`
314
- - `continue`
315
- - `custom`
316
-
317
- Claude Code, Cursor, Windsurf, Codex, and Gemini have native or generated hook
318
- surfaces. Mistral, ChatGPT, VS Code, Continue, and custom clients are MCP-first presets: companion
319
- prints the hosted MCP config/reference and installs dashboard-generated
320
- automation files only when the hosted project exposes a bundle for that client.
321
-
322
- ## Quick Start
323
-
324
- ### Claude Code
82
+ Use `npx` for one-off checks:
325
83
 
326
84
  ```bash
327
- npx -y snipara-companion@latest init --with-hooks --client claude-code
85
+ npx -y snipara-companion impact src/auth/session.ts --source local
328
86
  ```
329
87
 
330
- ### Cursor
88
+ Install globally only if you use it every day:
331
89
 
332
90
  ```bash
333
- npx -y snipara-companion@latest init --with-hooks --client cursor
334
- ```
335
-
336
- ### Windsurf
337
-
338
- ```bash
339
- npx -y snipara-companion@latest init --with-hooks --client windsurf
340
- ```
341
-
342
- ### Codex
343
-
344
- ```bash
345
- npx -y snipara-companion@latest init --client codex
346
- ```
347
-
348
- ### Gemini Or Other MCP Clients
349
-
350
- ```bash
351
- npx -y snipara-companion@latest init --client gemini
352
- npx -y snipara-companion@latest init --client mistral
353
- npx -y snipara-companion@latest init --client vscode
354
- npx -y snipara-companion@latest init --client continue
355
- npx -y snipara-companion@latest init --client custom
356
- ```
357
-
358
- ### Dashboard-Generated Automations
359
-
360
- Use `automations install` when you want the local project to match the hook
361
- bundle generated by Project Automation in the dashboard:
362
-
363
- ```bash
364
- npx -y snipara-companion@latest automations install --client claude-code
365
- npx -y snipara-companion@latest automations install --client cursor
366
- npx -y snipara-companion@latest automations install --client windsurf
367
- npx -y snipara-companion@latest automations install --client codex
368
- npx -y snipara-companion@latest automations status
369
- npx -y snipara-companion@latest automations diff
370
- npx -y snipara-companion@latest automations update
371
- ```
372
-
373
- The companion fetches the current project bundle from the hosted dashboard API,
374
- writes the generated files, and tracks them in
375
- `.snipara/automations/manifest.json`. Generated scripts read the API key from
376
- `SNIPARA_API_KEY` or the existing companion config created by
377
- `create-snipara`/`npx -y snipara-companion@latest init`; the install flow does not prompt for
378
- or embed a second key. Managed files are not overwritten after local edits
379
- unless you pass `--force`.
380
-
381
- Agent instruction files are always merged, not replaced. Existing `AGENTS.md`,
382
- `CLAUDE.md`, `GEMINI.md`, `.cursorrules`, and Copilot instructions keep their
383
- local content while Snipara adds or refreshes a marked Snipara section. Known
384
- client JSON configs for Claude, Cursor, Continue.dev, Windsurf, Gemini, VS Code,
385
- and root `mcp.json` are deep-merged so existing servers and hooks are preserved.
386
- Mistral generates MCP-first files (`MISTRAL.md`, Vibe config, Le Chat connector
387
- reference, and LangChain `ChatMistralAI.bindTools` snippets); Mistral request
388
- hooks are model request hooks, not local agent lifecycle hooks.
389
-
390
- OpenClaw hooks remain separate:
391
-
392
- ```bash
393
- npx snipara-openclaw-hooks install
394
- ```
395
-
396
- ## Commands
397
-
398
- ### `snipara-companion init`
399
-
400
- Initialize local configuration and optionally generate client hook files.
401
-
402
- ```bash
403
- npx -y snipara-companion@latest init
404
- ```
405
-
406
- Options:
407
-
408
- - `--api-key <key>` - Skip prompt for API key
409
- - `--project <project>` - Skip prompt for project slug or ID
410
- - `--project-id <id>` - Deprecated alias for `--project`
411
- - `--client <client>` - `claude-code`, `cursor`, `windsurf`, `codex`, `gemini`, `chatgpt`, `vscode`, `continue`, or `custom`
412
- - `--with-hooks` - Install hooks automatically
413
- - `--force` - Overwrite existing generated files
414
- - `--dir <directory>` - Target directory for generated files
415
-
416
- ### `snipara-companion config`
417
-
418
- Show the current configuration.
419
-
420
- ```bash
421
- snipara-companion config
422
- ```
423
-
424
- ### `snipara-companion pre-tool`
425
-
426
- Resolve a query from tool input, emit a canonical tool call, and print a Rescue Pack when hosted Stuck Guard asks for intervention.
427
-
428
- ```bash
429
- snipara-companion pre-tool '{"path":"/src/api/auth.ts"}'
430
- snipara-companion pre-tool '{"tool":"Bash","command":"pnpm db:push"}'
431
- ```
432
-
433
- ### `snipara-companion post-tool`
434
-
435
- Track file access and emit a canonical tool result for the current session.
436
-
437
- ```bash
438
- snipara-companion post-tool '{"file_path":"/src/api/auth.ts"}'
439
- snipara-companion post-tool '{"tool":"Bash","command":"pnpm test","exit_code":1}'
440
- ```
441
-
442
- ### `snipara-companion stuck-guard`
443
-
444
- Inspect or simulate hosted Memory Guard decisions.
445
-
446
- ```bash
447
- snipara-companion stuck-guard status
448
- snipara-companion stuck-guard check --tool Bash --command "pnpm db:push" --exit-code 1
449
- snipara-companion stuck-guard simulate --fixture ./stuck-guard-fixture.json
450
- ```
451
-
452
- Use `status` to inspect the current session window. Use `check` from local scripts when you have a single current tool result. Use `simulate` for repeatable fixtures before turning on `enforce` mode.
453
-
454
- ### `snipara-companion session-end`
455
-
456
- Persist the current session.
457
-
458
- ```bash
459
- snipara-companion session-end
460
- ```
461
-
462
- ### `snipara-companion session status`
463
-
464
- Show current session information.
465
-
466
- ```bash
467
- snipara-companion session status
468
- ```
469
-
470
- ### `snipara-companion session reset`
471
-
472
- Start a new session ID locally.
473
-
474
- ```bash
475
- snipara-companion session reset
476
- ```
477
-
478
- ### `snipara-companion emit-event`
479
-
480
- Forward a canonical lifecycle event into Snipara's hosted automation API.
481
-
482
- ```bash
483
- snipara-companion emit-event \
484
- --event-type tool_call \
485
- --payload '{"hook":"pre-tool","tool":"Read","query":"auth middleware"}'
486
- ```
487
-
488
- ### `snipara-companion automations`
489
-
490
- Install and maintain dashboard-generated automation hook bundles locally.
491
-
492
- ```bash
493
- npx -y snipara-companion@latest automations install --client claude-code
494
- npx -y snipara-companion@latest automations install --client cursor --dir ./app
495
- npx -y snipara-companion@latest automations install --client gemini --dir ./app
496
- npx -y snipara-companion@latest automations diff
497
- npx -y snipara-companion@latest automations update
498
- npx -y snipara-companion@latest automations status
499
- ```
500
-
501
- The install/update flow refuses to overwrite unmanaged files or managed
502
- generated hook scripts that changed locally. Markdown instruction files and
503
- known JSON configs are merged instead of replaced. Use `diff` first, then
504
- `--force` only when replacing a managed script is intentional.
505
-
506
- Use this when a thin local adapter needs to report lifecycle activity without owning
507
- durable memory policy locally.
508
-
509
- ### Workflow Commands
510
-
511
- These are thin local wrappers around hosted Snipara workflows:
512
-
513
- ```bash
514
- npx -y snipara-companion@latest workflow run --mode standard --query "who imports src.mcp_transport"
515
- npx -y snipara-companion@latest workflow run --mode full --include-session-context --query "plan the auth refactor"
516
- npx -y snipara-companion@latest plan --query "plan the auth refactor" --write-plan-file .snipara/workflow/plans/auth-refactor-plan.json
517
- npx -y snipara-companion@latest task-commit --summary "Shipped auth refactor" --files apps/web/src/lib/auth.ts
518
-
519
- snipara-companion query --query "auth middleware"
520
- snipara-companion query --query "who calls src.mcp_transport.handle_call_tool" --follow-recommendation
521
- snipara-companion status
522
- snipara-companion brief --task "ship auth hardening" --changed-files apps/web/src/lib/auth.ts tests/auth.test.ts --diff-summary "auth hardening"
523
- snipara-companion handoff --summary "auth hardening implemented" --next "run permissions tests" --files apps/web/src/lib/auth.ts --output handoff.md
524
- snipara-companion intelligence brief --task "ship auth hardening" --changed-files apps/web/src/lib/auth.ts tests/auth.test.ts --diff-summary "auth hardening"
525
- snipara-companion workflow scaffold --preset project-intelligence-continuity-layer --output .snipara/workflow/plans/project-intelligence-plan.json
526
- snipara-companion plan --query "ship auth hardening" --start-workflow --workflow-id auth-hardening
527
- snipara-companion workflow start --goal "ship auth hardening" --plan-file ./plan.json
528
- snipara-companion workflow status
529
- snipara-companion workflow impact-gate
530
- snipara-companion timeline
531
- snipara-companion workflow phase-start context
532
- snipara-companion workflow run --mode standard --query "who imports src.mcp_transport"
533
- snipara-companion workflow run --mode full --include-session-context --query "load context for the auth refactor"
534
- snipara-companion workflow phase-commit context --summary "Loaded context and mapped impacted files" --files src/auth.ts
535
- snipara-companion workflow resume --include-session-context
536
- snipara-companion workflow phase-start implementation
537
- snipara-companion workflow run --mode full --include-session-context --query "implement the auth refactor"
538
- snipara-companion workflow run --mode full --no-runtime-hint --query "implement the auth refactor"
539
- snipara-companion workflow run --mode orchestrate --query "map production rollout risks"
540
- snipara-companion workflow final-commit --summary "Shipped auth hardening and tests" --files src/auth.ts tests/auth.test.ts
541
- snipara-companion final-commit --summary "Shipped auth hardening and tests" --files src/auth.ts tests/auth.test.ts
542
- snipara-companion doctor
543
- snipara-companion doctor --json
544
- snipara-companion code callers --qualified-name src.mcp_transport.handle_call_tool
545
- snipara-companion code imports --file-path src/mcp_transport.py
546
- snipara-companion code neighbors --qualified-name src.mcp_transport.handle_call_tool
547
- snipara-companion code shortest-path --from src.server.mcp_endpoint --to src.mcp_transport.handle_call_tool
548
- snipara-companion code symbol-card --qualified-name src.mcp_transport.handle_call_tool
549
- snipara-companion code impact --changed-files apps/web/src/lib/auth.ts tests/auth.test.ts --diff-summary "auth hardening"
550
- snipara-companion plan --query "implement OAuth device flow"
551
- snipara-companion upload --path docs/spec.md --file ./docs/spec.md
552
- snipara-companion upload --path clients/acme/current.md --file ./current.md --asset-class BUSINESS_DOCUMENT --usage-mode current_truth --source-kind local_agent --client-id acme
553
- snipara-companion upload --path diagrams/network.vsdx --file ./diagrams/network.vsdx --kind BINARY --format vsdx --reindex
554
- snipara-companion upload --path docs/spec.md --file ./docs/spec.md --reindex
555
- snipara-companion references scan --allow-domain docs.stripe.com --allow-domain docs.github.com
556
- snipara-companion references ingest --upload --reindex
557
- snipara-companion business-collections list
558
- snipara-companion business-collections ensure --preset business_response_playbook
559
- snipara-companion business-collections ensure --preset offer_templates
560
- snipara-companion business-collections upload --preset offer_templates --title "Standard Offer Structure" --file ./offer-template.md
561
- snipara-companion client-projects list
562
- snipara-companion client-projects create --name "ACME Network Refresh" --slug acme-network-refresh
563
- snipara-companion onboard-folder ./client-export --source-provider chatgpt_drive --write-manifest ./snipara-onboard.json
564
- snipara-companion onboard-folder ./client-export --source-provider claude_notion --apply
565
- snipara-companion sync-documents --dir ./docs --recursive --prefix docs --reindex
566
- snipara-companion sync-documents --file ./snipara-documents.json --delete-missing --reindex
567
- snipara-companion sync-documents --file ./snipara-business-context.json --dry-run --json
568
- snipara-companion reindex --kind doc --mode incremental
569
- snipara-companion reindex --job-id index_job_123
570
- snipara-companion business-health --json
571
- snipara-companion memory audit --scope project --include-inactive
572
- snipara-companion memory health --scope project --json
573
- snipara-companion memory clean-candidates --scope project --limit-per-bucket 10
574
- snipara-companion memory compact --scope project --json
575
- snipara-companion memory invalidate mem_old --reason "obsolete runbook"
576
- snipara-companion memory supersede mem_old mem_new --reason "corrected decision"
577
- snipara-companion memory local -- version
578
- snipara-companion eval export \
579
- --summary "Implemented auth hardening and ran tests" \
580
- --decision "Code graph remains hosted" \
581
- --verification "pnpm test" \
582
- --continuity "Leave a concise next-step handoff" \
583
- --files src/auth.ts tests/auth.test.ts \
584
- --command-run "pnpm test" \
585
- --output .snipara/evals/auth-hardening.json
586
- snipara-companion eval run .snipara/evals/auth-hardening.json --strict
587
- snipara-companion chunk get --chunk-id chunk_123
588
- snipara-companion multi-query --queries "auth flow" "rate limiting"
589
- snipara-companion orchestrate --query "understand the auth architecture"
590
- snipara-companion load-document --path docs/auth.md
591
- snipara-companion recall --query "What did we decide about auth retries?" --type decision
592
- snipara-companion events recent --limit 20
593
- snipara-companion session-bootstrap --max-critical-tokens 2000
594
- snipara-companion session-bootstrap --include-session-context --max-context-tokens 1000
595
- snipara-companion task-commit --summary "Shipped event ingestion and dashboard inspection" --files apps/web/src/components/automation/automation-settings-panel.tsx
596
- ```
597
-
598
- The installed executable is `snipara-companion`. Prefer `npx -y snipara-companion@latest ...`
599
- for one-off commands when you need to bypass a stale global binary; there is no separate `snipara-workflow` binary.
600
- `snipara-companion` does not execute Snipara Sandbox jobs itself. Snipara Sandbox MCP `execute_python` can run
601
- without an extra LLM provider key because your AI client supplies the reasoning; standalone
602
- `snipara-sandbox run` and `snipara-sandbox agent` need an `OPENAI_API_KEY` or `ANTHROPIC_API_KEY`.
603
- `workflow resume` restores local workflow state plus hosted memory/handoff continuity. For
604
- runtime-bound phases it also restores the recorded Sandbox binding and prints a reattach or
605
- rehydrate plan. It does not snapshot or exactly restore a live Snipara Sandbox or REPL process.
606
- Short-lived session context is skipped unless you pass `--include-session-context`
607
- or an explicit `--max-context-tokens`; durable memory still loads by default.
608
- `workflow run --mode full --json` also reports `workflow_budget`,
609
- `session_bootstrap_quality`, and `plan_quality.warnings` so agents can detect
610
- oversized bootstrap context or weak generated-plan file hints before editing.
611
- `doctor` reports the running companion version and warns when the workspace
612
- `packages/cli` package or npm latest is newer than the installed binary.
613
- For diagnostics and Snipara Sandbox hints, companion also detects these keys in local `.env`, `.env.local`,
614
- `.env.development`, and `.env.development.local` files without printing their values.
615
-
616
- By default these commands print human-readable terminal output. Add `--json` when you want the raw
617
- hosted response.
618
-
619
- ### Team Sync Continuity
620
-
621
- `snipara-companion team-sync` always keeps the local continuity file at
622
- `.snipara/team-sync/session.json`. When the workspace is configured with a
623
- project API key, the same commands also call the hosted Team Sync surfaces:
624
-
625
- - `team-sync start-work` records local intent, reports whether the hosted Start Work Brief loaded, and fetches the brief when project auth is configured.
626
- - `team-sync handoff` records the local handoff and publishes the hosted handoff capsule.
627
- - `team-sync what-changed` keeps local counters but also loads the hosted What Changed For Me surface.
628
- - `team-sync resume` and `workflow resume` append the latest hosted handoff plus checkpoint-aware resume context when available.
629
- - `team-sync sweep` archives local work items after 14 days without update by default; use `--dry-run` to review before changing the local continuity file.
630
- - Hosted MCP also exposes `snipara_resume_context` for agents that want the same continuity bundle directly: latest handoff match, What Changed, active decisions, execution-memory, and an optional task-scoped work brief.
631
-
632
- Typical flow:
633
-
634
- ```bash
635
- snipara-companion team-sync start-work --summary "add invite permissions" --files apps/web/src/lib/auth/permissions.ts
636
- snipara-companion team-sync handoff --summary "moved project access check" --next "run permissions tests before merge" --attention proof
637
- snipara-companion team-sync what-changed
638
- snipara-companion team-sync sweep --dry-run
639
- snipara-companion workflow resume --include-session-context
640
- snipara-companion workflow phase-start implement-permissions
641
- ```
642
-
643
- ### GitHub PR Answer Packs
644
-
645
- PR Answer Packs are a hosted GitHub App feature. `snipara-companion` does not
646
- install the GitHub App and does not publish PR checks or comments itself.
647
-
648
- Use `create-snipara` from the repository you want to connect:
649
-
650
- ```bash
651
- npx create-snipara --github
652
- ```
653
-
654
- After the repo is connected, PR Answer Packs can provide scoped repository
655
- context for pull requests. Generated packs now include Team Sync review context
656
- such as collisions, linked decisions, reviewer hints, verification checklist,
657
- source map, and the latest hosted handoff when relevant. Locally, use companion
658
- commands around that workflow:
659
-
660
- ```bash
661
- snipara-companion code impact --changed-files src/auth.ts tests/auth.test.ts --diff-summary "auth refactor PR"
662
- snipara-companion workflow run --mode auto --query "What repository context should an agent load for this PR?"
663
- snipara-companion task-commit --summary "Validated PR Answer Pack release docs" --category release --outcome completed --files packages/create-snipara/README.md
664
- ```
665
-
666
- Only add a dedicated `snipara-companion github answer-packs` command if Snipara
667
- ships a public API for manual regeneration or inspection outside the dashboard.
668
-
669
- ### External References
670
-
671
- Use `references` when repository docs point at source material the agent may not
672
- be able to fetch directly, such as SDK docs, vendor runbooks, RFCs, or client
673
- pages:
674
-
675
- ```bash
676
- snipara-companion references scan \
677
- --allow-domain docs.stripe.com \
678
- --allow-domain docs.github.com
679
-
680
- snipara-companion references ingest --dry-run
681
- snipara-companion references ingest --upload --reindex
682
- ```
683
-
684
- `scan` writes `.snipara/references/manifest.json` with each URL, source file,
685
- line number, domain, and allowlist status. URLs are only ingested when their
686
- domain is allowlisted in the manifest or passed with `--allow-domain` at ingest
687
- time. `ingest` fetches allowed URLs into local Markdown snapshots under
688
- `.snipara/references/snapshots/`; `--upload` sends those snapshots to Snipara as
689
- external reference documents with source URL, content hash, fetch time, HTTP
690
- metadata, and referenced-from provenance.
691
-
692
- ### Project Intelligence Briefs
693
-
694
- Use `intelligence brief` when a task needs a local continuity readout for
695
- memory authority, code impact, verification hints, and the Project Intelligence
696
- Judgment Card:
697
-
698
- ```bash
699
- snipara-companion intelligence brief \
700
- --task "add workspace invite policy" \
701
- --changed-files apps/web/src/lib/workspace-invites.ts apps/web/src/lib/workspace-invites.test.ts \
702
- --diff-summary "workspace invite policy change"
703
- ```
704
-
705
- The command calls hosted `snipara_resume_context` and `snipara_memory_health`.
706
- When changed files are provided, code impact uses companion auto-source
707
- selection, so dirty/ahead worktrees use the local overlay and clean configured
708
- checkouts use hosted graph impact. It prints continuity signals, memory health,
709
- risk and verification hints, degraded surfaces, and the Judgment Card's
710
- weighted readiness, evidence, and required actions.
711
-
712
- Use top-level `run` when the agent should make a production-oriented go/no-go
713
- judgment in one pass:
714
-
715
- ```bash
716
- snipara-companion run \
717
- --task "ship auth hardening" \
718
- --changed-files src/auth.ts tests/auth.test.ts \
719
- --diff-summary "auth hardening" \
720
- --release
721
- ```
722
-
723
- `run --release` composes the Project Intelligence brief, collaboration guard,
724
- package-surface review, verification plan, and final Judgment Card. Review-only
725
- guard findings can be acknowledged with the printed guard action card command;
726
- blocking conflicts still make the release judgment non-proceedable.
727
- When a served judgment id is available, add `--served-judgment-id` so `run` can
728
- write first-party Advisor Influence receipts for recommendations that visibly
729
- change the plan. The receipt payload includes stable skip/record counts,
730
- bounded automation metadata, and observed verification evidence from guard,
731
- package review, and policy-gate results without treating those checks as
732
- outcome proof.
733
-
734
- For the full Project Intelligence and Continuity Layer roadmap, scaffold the
735
- built-in managed workflow plan:
736
-
737
- ```bash
738
- snipara-companion workflow scaffold \
739
- --preset project-intelligence-continuity-layer \
740
- --output .snipara/workflow/plans/project-intelligence-plan.json
741
- ```
742
-
743
- ### Context vs Memory
744
-
745
- - Use `snipara-companion query`, `shared-context`, and `load-document` for source truth.
746
- - Use `snipara-companion recall`, `session-bootstrap`, and `task-commit` for durable memory.
747
- - Do not use memory as a substitute for document retrieval.
748
- - Do not upload specs or raw documents into memory.
749
-
750
- Semantics:
751
-
752
- - `snipara-companion query --follow-recommendation` = execute the hosted recommended structural tool instead of only printing it
753
- - `snipara-companion workflow run --mode lite` = focused context query for small known-file work
754
- - `snipara-companion workflow run --mode standard` = context query plus automatic `snipara_code_*` follow-up when Snipara recommends one
755
- - `snipara-companion workflow run --mode auto` = compatibility alias for STANDARD behavior
756
- - `snipara-companion workflow run --mode full` = budgeted durable bootstrap + optional session context + context query + automatic structural follow-up + hosted plan with quality diagnostics
757
- - `snipara-companion plan --write-plan-file ./plan.json` = convert hosted `snipara_plan` output into managed workflow JSON
758
- - `snipara-companion plan --start-workflow` or `workflow run --mode full --start-workflow-from-plan` = create local `.snipara/workflow/current.json` from a valid generated plan
759
- - `snipara-companion workflow run --mode orchestrate` = explicit hosted orchestrator flow for deeper multi-step exploration; use the Python `snipara-orchestrator` package for production gates and htasks
760
- - `snipara-companion workflow run` = suggests Snipara Sandbox when the query calls for validation, execution, data transforms, or heavier FULL/orchestrated work
761
- - `snipara-companion status` = top-level agentic work status across local workflow state, git dirtiness, and Team Sync carryover
762
- - `snipara-companion brief` = short alias for `snipara-companion intelligence brief`
763
- - `snipara-companion timeline` = local timeline of workflow starts, phase starts, phase commits, final commits, and Team Sync handoffs
764
- - `snipara-companion handoff` = top-level agent-ready Markdown/JSON handoff artifact plus the same local/hosted Team Sync handoff persistence
765
- - `snipara-companion intelligence brief` = one local Project Intelligence brief that combines resume context, memory health, and code impact for a task
766
- - `snipara-companion run` = production Project Intelligence flow that combines the brief, guard action cards, package review, verification hints, and a final weighted Judgment Card
767
- - `snipara-companion workflow start --plan-file` = records the visible LLM plan locally so phase state survives agent compaction; prefer JSON plans with explicit ids for stable machine phase state
768
- - `snipara-companion workflow scaffold --preset project-intelligence-continuity-layer` = creates a four-phase managed plan for memory authority, code impact, continuity summaries, and release/docs surfaces
769
- - `snipara-companion workflow phase-start` = marks the current phase and prints the required Snipara context gate plus code-impact / symbol-card gates; runtime-marked phases also get a stable Snipara Sandbox session binding
770
- - `snipara-companion workflow runtime-checkpoint` = captures a resume-ready Snipara Sandbox checkpoint for one phase using local workflow state plus a hosted automation event when configured
771
- - `snipara-companion workflow phase-commit` = calls hosted `snipara_end_of_task_commit` for that phase, updates local state, and advances the next phase; if the hosted commit times out or hits a transient network failure, local workflow state still advances with an explicit local fallback record
772
- - `snipara-companion workflow impact-gate` = local pre-push gate for completed workflow phases in `upstream..HEAD`; it keeps dirty files out of the committed impact analysis and reports phase/file coverage before hosted reindex catches up
773
- - `snipara-companion workflow resume` = reloads local workflow state plus hosted durable memory after compaction or resume, optionally includes short-lived session context with `--include-session-context`, then appends the latest hosted Team Sync handoff/checkpoint context when available; runtime-bound phases also print a Snipara Sandbox reattach or rehydrate plan; rerun `workflow phase-start` before editing again
774
- - `snipara-companion workflow resume` does not snapshot or exactly restore a live Snipara Sandbox process; exact process restore remains a roadmap item
775
- - `snipara-companion team-sync start-work` = keeps the local session file, reports Start Work Brief status, and fetches the hosted brief when the workspace has project auth
776
- - `snipara-companion team-sync handoff` = keeps the local handoff record and publishes the hosted handoff capsule when project auth is available
777
- - `snipara-companion team-sync what-changed` = prints the local state summary and the hosted What Changed For Me response when configured
778
- - `snipara-companion team-sync sweep` = archives stale local work items after an inactivity threshold; default is 14 days and `--dry-run` previews the cleanup
779
- - `snipara-companion team-sync resume` = reloads local carryover plus the hosted latest handoff and checkpoint-aware resume guidance when available
780
- - `snipara-companion final-commit` / `workflow final-commit` = final hosted commit for the managed workflow
781
- - `snipara-companion code callers/imports/neighbors/shortest-path/impact` = primary code graph surface for agents with shell access. These commands use `--source auto` by default; clean configured checkouts use hosted MCP, dirty/ahead worktrees use the local overlay, and every response reports `sourceSelection` plus agent guidance.
782
- - `snipara-companion code symbol-card` = direct paid Context `snipara_code_symbol_card` for an important symbol before editing, with an agent guidance summary before raw JSON
783
- - `snipara-companion code impact --source hosted|local` = optional source override for debugging; normal agent instructions should leave `--source auto` in place. Hosted `snipara_code_impact` is the fallback when companion is unavailable or the canonical graph check after push/reindex.
784
- - `snipara-companion code local impact` = explicit repository-local file-level import impact from the local code overlay; keep this for power-user/debug workflows, and use `workflow impact-gate` when the file set should come from unpushed workflow commits
785
- - `snipara-companion doctor` = local readiness check for companion version skew, Snipara auth, deterministic hosted tool catalog access, Snipara Sandbox, Snipara Sandbox MCP wiring, provider keys, and Docker
786
- - `snipara-companion upload --metadata/--metadata-file` = single-file upload with the same business/client metadata fields supported by bulk sync
787
- - `snipara-companion business-collections` = manage reusable Team Business Context collections (Business Response Playbook, Business Library, Offer Templates, Company Presentations, Reference Diagrams)
788
- - `snipara-companion client-projects` = create/list project-scoped client context workspaces before uploading current client files
789
- - `snipara-companion onboard-folder` = business-first import for a local or LLM-materialized folder; it still detects code/mixed folders, but code repositories should use the GitHub OAuth/code onboarding path
790
- - `snipara-companion sync-documents` = bulk `snipara_sync_documents` for text and supported binary parser documents from a JSON payload or directory
791
- - `snipara-companion sync-documents --dry-run` = validate the local payload and business-context freshness metadata without uploading
792
- - `snipara-companion business-health` = hosted `snipara_index_health`, with the `business_context` section surfaced for stale/reupload signals
793
- - `snipara-companion memory audit` = read-only memory hygiene pass that combines `snipara_memory_health`, `snipara_memory_clean_candidates`, and `snipara_memory_compact(dry_run=true)`
794
- - `snipara-companion memory health` = direct hosted `snipara_memory_health` diagnostics for active counts, stale/noise/anomaly samples, and auto-compaction threshold status
795
- - `snipara-companion memory clean-candidates` = direct hosted `snipara_memory_clean_candidates` review packet for noise, stale memories, duplicates, category anomalies, and human review queues
796
- - `snipara-companion memory compact` = hosted compaction preview only; it always calls `snipara_memory_compact` with `dry_run=true` and never mutates memory
797
- - `snipara-companion memory invalidate <memory-id>` = hosted `snipara_memory_invalidate` for lifecycle correction without deleting memory
798
- - `snipara-companion memory supersede <old-memory-id> <new-memory-id>` = hosted `snipara_memory_supersede` for replacing obsolete memory with a newer approved memory
799
- - `snipara-companion memory local -- <args...>` = pass-through to the open `snipara-memory` CLI for local no-account memory workflows
800
- - `snipara-companion eval export` = write a `snipara-evals` case JSON from local workflow/team-sync state and explicit expected signals
801
- - `snipara-companion eval run <case.json...>` = run `snipara-evals` locally through `npx` or `SNIPARA_EVALS_RUNNER`
802
- - `snipara-companion reindex` = trigger or poll hosted `snipara_reindex`; use after uploads when immediate chunk availability matters
803
- - `snipara-companion code *` = direct access to the code graph tools without routing through `snipara_context_query`
804
- - `snipara-companion recall` = direct durable memory lookup for decisions, learnings, preferences, and carryover
805
- - `snipara-companion session-bootstrap` = durable memory first, optional weak session carryover second
806
- - `snipara-companion task-commit` = durable task/phase/workflow outcomes only, not a mechanical mirror of every Git commit
807
- - `snipara-companion memory-guard check` = forced memory/context recall before retries, commits, or finalization when a command failed or a publishable package surface is touched
808
- - `snipara-companion memory-guard check --intent "<action>" --destructive --strict` = contradiction check before irreversible actions; blocks until the user explicitly confirms when memory/context disagrees or the action is destructive
809
- - `snipara-companion memory-guard remember --guard-tag pre-commit --text "..."` = create a project/team memory in a guard category such as `pre-commit`, `commit`, `failure`, `pre-final`, or `workflow-policy`
810
- - `--max-daily-tokens` is still accepted as a compatibility alias for `--max-context-tokens`
811
-
812
- ### Memory Guard Before Commit Or Destructive Actions
813
-
814
- Memory Guard is deterministic, not a user preference. It detects two global signals:
815
-
816
- - failed or timed-out tool results emitted by Companion hooks
817
- - changed files under publishable npm or PyPI package manifests
818
- - explicit destructive or irreversible intent passed with `--intent` and `--destructive`
819
-
820
- When triggered, it recalls project guard memories by category and also queries source context before
821
- the agent retries, commits, or finalizes. Guard memories are just durable memories with a category tag:
822
-
823
- ```bash
824
- snipara-companion memory-guard remember \
825
- --guard-tag pre-commit \
826
- --text "For npm packages, run npm login --auth-type=web in a TTY, publish, then verify dist-tags and npx help."
827
- ```
828
-
829
- Run the check manually with:
830
-
831
- ```bash
832
- snipara-companion memory-guard check --trigger pre-commit --staged --strict
833
- snipara-companion memory-guard check \
834
- --intent "npm publish snipara-companion" \
835
- --destructive \
836
- --strict
837
- snipara-companion memory-guard check \
838
- --intent "npm publish snipara-companion" \
839
- --destructive \
840
- --strict \
841
- --confirmed-by-user "User confirmed npm publish after reviewing guard output"
842
- ```
843
-
844
- When memory or source context contradicts the requested action, the JSON output
845
- sets `requiresConfirmation=true`, includes `contradictions`, and provides a
846
- `confirmationPrompt`. In `--strict` mode the command exits non-zero until the
847
- operator has explicitly confirmed the override.
848
-
849
- Strict mode exit codes:
850
-
851
- - `20`: confirmation is required before continuing.
852
- - `21`: memory/context guidance was unavailable for a triggered guard.
853
- - `22`: guard options were invalid, for example `--destructive` without a
854
- specific `--intent` or `--command`.
855
-
856
- ### Commit Memory Policy
857
-
858
- Companion separates two concepts:
859
-
860
- - `git commit` is a version-control checkpoint.
861
- - `snipara-companion task-commit`, `workflow phase-commit`, and `final-commit` call hosted
862
- `snipara_end_of_task_commit` to persist meaningful task, phase, or workflow outcomes.
863
- `workflow phase-commit` and `final-commit` keep local workflow state moving on transient
864
- hosted commit timeouts and surface that local fallback explicitly in the result.
865
-
866
- Do not call `snipara_end_of_task_commit` mechanically for every Git commit. For risky commits,
867
- package releases, or retries after failures, run Memory Guard first so the agent sees relevant
868
- project memory and context. If a team wants automatic lightweight checkpoints for every Git commit,
869
- keep that in a separate hook or adapter; reserve `task-commit` for durable summaries worth recalling.
870
-
871
- ### Compaction-Safe LLM Plan Workflow
872
-
873
- Use this when the user's LLM has already produced a plan and Snipara should enforce the workflow around it. For coding work, choose LITE, STANDARD, FULL, or FULL + ORCHESTRATED explicitly before editing: LITE is for small single-phase changes, STANDARD is for normal context/code-graph work, FULL managed workflow is for multi-file, risky, release/deploy, architectural, compaction-prone, or maintainer-sensitive work, and FULL + ORCHESTRATED is for production proof gates, drift checks, htasks, or explicit multi-agent coordination.
874
-
875
- 1. Generate or save a visible plan into a JSON file. `snipara-companion plan --query "<goal>" --write-plan-file ./plan.json` converts hosted `snipara_plan` output into a managed workflow plan; keep a Markdown/Text copy only when you also want a human-facing contract alongside the machine plan.
876
- 2. Run `snipara-companion workflow start --goal "<goal>" --plan-file ./plan.json`.
877
- 3. At each phase/chunk, run `snipara-companion workflow phase-start <phase_id>`, then `snipara-companion workflow run --mode full --query "<phase query>"`. Add `--include-session-context` after compaction, handoff, or another agent's work may matter.
878
- 4. Before risky code changes, routes/services/jobs work, or any "what is missing" conclusion, run `snipara-companion code impact --changed-files <files...> --diff-summary "<change>"`. For an important symbol, run `snipara-companion code symbol-card --qualified-name <symbol>`.
879
- 5. After compaction, first run `snipara-companion workflow resume --include-session-context`, then rerun `snipara-companion workflow phase-start <phase_id>` before editing again.
880
- 6. For execution/test/debug/finalization that benefits from repeatable isolation, use Snipara Sandbox MCP `execute_python` from the AI client or standalone `snipara-sandbox run`. After material runtime progress, capture a resume-ready checkpoint with `snipara-companion workflow runtime-checkpoint <phase_id> --summary "<state>" --rehydrate-file <state.json>`.
881
- 7. For production gates, drift checks, or htask coordination, hand off explicitly to `snipara-orchestrator`; companion should detect and suggest the package but must not spawn workers automatically.
882
- 8. End every phase with `snipara-companion workflow phase-commit <phase_id> --summary "<outcome>" --files <files...>`.
883
- 9. End the whole task with `snipara-companion final-commit --summary "<final outcome>" --files <files...>`.
884
-
885
- After compaction or resume, run `snipara-companion workflow resume --include-session-context` when short-lived carryover matters, then rerun `snipara-companion workflow phase-start <phase_id>`. The local state file tells the agent the current phase, and hosted memory contains durable phase outcomes.
886
-
887
- `snipara-companion` does not execute Snipara Sandbox jobs itself. For runtime-bound phases it can bind a stable Sandbox session, capture a runtime checkpoint, and print a reattach or rehydrate plan on `workflow resume`, but it still does not exactly restore a live Snipara Sandbox / REPL process. Snipara Sandbox MCP `execute_python` can run
888
- without an extra LLM provider key because your AI client supplies the reasoning; standalone
889
- `snipara-sandbox run` and `snipara-sandbox agent` need an `OPENAI_API_KEY` or `ANTHROPIC_API_KEY`.
890
-
891
- `sync-documents --file` accepts either a JSON array or an object with a
892
- `documents` array. Object payloads can also include manifest-level metadata
893
- defaults and workflow defaults:
894
-
895
- ```json
896
- {
897
- "dryRun": true,
898
- "reindex": true,
899
- "metadata": {
900
- "assetClass": "BUSINESS_DOCUMENT",
901
- "usageMode": "current_truth",
902
- "sourceKind": "google_drive",
903
- "freshnessPolicy": {
904
- "maxAgeDays": 30,
905
- "requireSourceModifiedAt": true
906
- }
907
- },
908
- "documents": [
909
- {
910
- "path": "docs/spec.md",
911
- "content": "# Spec\n\n...",
912
- "kind": "DOC",
913
- "format": "md",
914
- "metadata": {
915
- "clientId": "xyz",
916
- "sourceModifiedAt": "2026-04-25T10:20:00Z",
917
- "sourceSnapshotAt": "2026-04-25T10:30:00Z",
918
- "sourceContentHash": "sha256:..."
919
- }
920
- },
921
- {
922
- "path": "diagrams/network.vsdx",
923
- "content": "base64:<payload>",
924
- "kind": "BINARY",
925
- "format": "vsdx",
926
- "metadata": {
927
- "assetClass": "DIAGRAM",
928
- "usageMode": "historical_reference",
929
- "sourceKind": "local_agent"
930
- }
931
- }
932
- ]
933
- }
934
- ```
935
-
936
- When using `sync-documents --dir`, companion collects `.md`, `.markdown`,
937
- `.mdx`, `.txt`, `.rst`, `.adoc`, `.pdf`, `.docx`, `.pptx`, `.svg`, and
938
- `.vsdx`. Binary parser files are encoded as `base64:<payload>` and sent with
939
- `kind=BINARY` plus the inferred `format`.
940
-
941
- Use `usageMode=current_truth` for the active client/project source of truth,
942
- `usageMode=historical_reference` for previous client deliverables that should
943
- serve as a case library, and `usageMode=template` or `global_knowledge` for
944
- reusable business patterns. Snipara uses this metadata in index health to
945
- distinguish reindex, reupload, metadata review, and quality review actions.
946
-
947
- `onboard-folder` is the MVP path for dashboardless business imports. Let
948
- Claude, ChatGPT, Codex, or another agent use its own Drive, Gmail, Notion, or
949
- local-file access to materialize a folder, then run:
950
-
951
- ```bash
952
- snipara-companion onboard-folder ./client-export --source-provider chatgpt_drive --write-manifest ./snipara-onboard.json
953
- snipara-companion onboard-folder ./client-export --source-provider chatgpt_drive --apply
954
- ```
955
-
956
- The command scans recursively by default, skips build/cache directories,
957
- classifies the folder as `business_context`, `code_project`, `mixed`, or
958
- `unknown`, and adds provenance metadata such as `sourceProvider`,
959
- `sourceSnapshotAt`, `sourcePath`, and `sourceContentHash`. It never infers a
960
- remote URI; pass `--source-uri` when the source system gives you a safe
961
- identifier. This is import-on-demand, not continuous sync. Unsupported
962
- business-looking files such as spreadsheets are reported in the preview instead
963
- of silently uploaded. If the folder is detected as a code repository, the
964
- command warns instead of pretending to handle source-code onboarding; use the
965
- GitHub OAuth/code onboarding path for that.
966
-
967
- Dry-runs are local only: they validate payload shape, known metadata fields,
968
- and freshness signals such as expired snapshots or changed source hashes. They
969
- do not call hosted MCP and therefore cannot know remote `created`, `updated`,
970
- or `unchanged` counts until a real sync runs.
971
-
972
- For release-hardening and local packaging checks:
973
-
974
- ```bash
975
- pnpm --filter snipara-companion pack:smoke
976
- pnpm --filter create-snipara pack:smoke
977
- ```
978
-
979
- To test a packed tarball manually, use `npm exec --package`:
980
-
981
- ```bash
982
- npm pack
983
- npm exec --package ./snipara-companion-1.4.14.tgz snipara-companion -- --help
984
- ```
985
-
986
- Do not use `npx /path/to/snipara-companion-*.tgz`. npm will try to execute the tarball itself instead of
987
- resolving the packaged `snipara-companion` binary.
988
-
989
- Design rule:
990
-
991
- - local CLI = workflow facade
992
- - hosted Snipara = source of truth for context, chunks, plans, memory, and review policy
993
- - use `companion` for daily coding ergonomics and auto-routing
994
- - use `orchestrate` only when the task is genuinely multi-step and exploration-heavy
995
- - use `snipara-orchestrator` only for proof-based validation, drift detection, htasks, and production gates
996
-
997
- ### `snipara-companion cache clear`
998
-
999
- Clear the local query cache.
1000
-
1001
- ```bash
1002
- snipara-companion cache clear
91
+ npm install -g snipara-companion
92
+ snipara-companion impact src/auth/session.ts
93
+ snipara-companion workflow resume
1003
94
  ```
1004
95
 
1005
- ## Positioning
1006
-
1007
- - Use Hosted MCP as the main Snipara agent surface.
1008
- - Use `create-snipara` as the normal setup path; it installs `snipara-companion` by default.
1009
- - Use `hosted-only` when a user cannot install local helper tooling.
1010
-
1011
- ## Related Packages
1012
-
1013
- - `snipara-mcp` - core MCP client
1014
- - `create-snipara` - onboarding for Hosted MCP + companion workflows, with optional Snipara Sandbox and explicit orchestrator add-on
1015
- - `snipara-orchestrator` - production validation, drift checks, and htask orchestration
1016
- - `snipara-openclaw-hooks` - OpenClaw-specific automation hooks
96
+ ## Command Reference
1017
97
 
1018
- ## License
98
+ The previous long README has moved to [docs/FULL_REFERENCE.md](./docs/FULL_REFERENCE.md).
99
+ Start there for the full command list, hook setup, hosted MCP bridge commands,
100
+ workflow modes, team-sync, local context packs, and release-oriented flows.
1019
101
 
1020
- MIT
102
+ Release notes live in [CHANGELOG.md](./CHANGELOG.md).