@hivelore/cli 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hivelore contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,668 @@
1
+ <p align="center">
2
+ <a href="https://github.com/Doucs91/hivelore">
3
+ <img src="https://raw.githubusercontent.com/Doucs91/hivelore/main/packages/vscode/media/wordmark.svg" alt="Hivelore" width="240" />
4
+ </a>
5
+ </p>
6
+
7
+ # @hivelore/cli
8
+
9
+ > **Hivelore** - repo-native memory and context policy for coding-agent harnesses.
10
+
11
+ Hivelore makes your team knowledge enforceable inside the harness around AI coding agents. It gives agents a required briefing before work starts, stores decisions/gotchas/failed attempts as version-controlled Markdown, and adds MCP, Git, CI, and wrapper gates so AI-generated changes cannot quietly bypass project policy.
12
+
13
+ The memory system is the mechanism. The CLI is the control plane: initialize context policy, run agents inside Hivelore, check the repo, and block unsafe workflow states. Hivelore complements tests, linters, evals, and observability by carrying the repo-specific knowledge they cannot infer.
14
+
15
+ ---
16
+
17
+ ## Install
18
+
19
+ ```bash
20
+ npm install -g @hivelore/cli
21
+ ```
22
+
23
+ This installs the `haive` command globally. **The MCP server is bundled** — use `hivelore mcp --stdio` in your AI client (no separate `@hivelore/mcp` install required for normal use).
24
+
25
+ > **Semantic search** (optional): install `@hivelore/embeddings` for local embedding-based search (no data leaves your machine).
26
+
27
+ > Legacy configs may still use the standalone `haive-mcp` binary from `@hivelore/mcp`; prefer `haive` so CLI and MCP versions always match.
28
+
29
+ ---
30
+
31
+ ## Quick start
32
+
33
+ ```bash
34
+ # 1. Initialize Hivelore in your project (strict enforcement ON by default)
35
+ cd my-project
36
+ hivelore init # .ai/, MCP config, hooks, CI, code-map
37
+ hivelore agent status # confirm MCP/wrapper/fallback mode
38
+ hivelore enforce install # re-apply strict MCP + Git + CI enforcement gates
39
+
40
+ # 2. Point your AI client at the MCP server
41
+ # Add to ~/.claude.json / ~/.cursor/mcp.json:
42
+ # { "mcpServers": { "hivelore": { "command": "hivelore", "args": ["mcp", "--stdio", "--root", "/absolute/path"] } } }
43
+
44
+ # 3. Bootstrap project context (run once in your AI client)
45
+ # → Use the bootstrap_project MCP prompt to analyze the codebase and fill .ai/project-context.md
46
+
47
+ # 4. Start work through Hivelore
48
+ hivelore briefing --task "add Stripe webhook"
49
+ hivelore run -- <agent-command> [args...] # for CLI agents without blocking hooks
50
+
51
+ # 5. Save durable policy knowledge manually (or let the agent use mem_save/mem_tried)
52
+ hivelore memory save \
53
+ --type gotcha --slug "jpa-open-in-view" --scope team \
54
+ --paths src/main/resources/application.properties \
55
+ --body "spring.jpa.open-in-view=false is intentional — do not re-enable."
56
+
57
+ # 6. Gate the workflow
58
+ hivelore enforce status
59
+ hivelore enforce check --stage pre-commit
60
+ hivelore enforce ci
61
+ ```
62
+
63
+ ---
64
+
65
+ ## Commands
66
+
67
+ The default help is intentionally small and centered on the core harness workflow. Run:
68
+
69
+ ```bash
70
+ hivelore --help
71
+ hivelore memory --help
72
+ ```
73
+
74
+ to see the focused surface. Maintenance and experimental commands remain available, but are hidden from default help:
75
+
76
+ ```bash
77
+ hivelore --advanced --help
78
+ hivelore --advanced memory --help
79
+ ```
80
+
81
+ This keeps Hivelore from feeling like a grab bag: day-to-day users see the core harness loop first - context loading, enforcement, diagnostics, sync, recaps, and the high-signal memory operations.
82
+
83
+ ### `hivelore init`
84
+
85
+ Initialize the `.ai/` structure in a project. **Autopilot mode is ON by default** and now installs strict enforcement gates by default.
86
+
87
+ ```bash
88
+ hivelore init # Autopilot: policy config, hooks, CI, MCP setup, code-map
89
+ hivelore init --manual # Manual mode: you approve every memory yourself
90
+ hivelore init --no-bridges # Skip native bridge generation (CLAUDE.md, AGENTS.md, etc.)
91
+ hivelore init --dir /other/path # Initialize in a specific directory
92
+ hivelore init --yes # Also approve user-level AI client MCP configuration
93
+ ```
94
+
95
+ **Autopilot mode** (default):
96
+ - Memories are saved directly as `validated` (no approval cycle)
97
+ - Git hooks installed automatically (`hivelore enforce check` gates commits/pushes)
98
+ - CI workflows generated (`haive-enforcement.yml` and sync workflow)
99
+ - Initial code-map built (`.ai/code-map.json`) for symbol lookup
100
+ - Session recaps saved automatically when the MCP server exits
101
+ - Configuration stored in `.ai/haive.config.json`
102
+
103
+ **Manual mode** (`--manual`):
104
+ - Memories start as `proposed` and require explicit approval (`hivelore memory approve`)
105
+ - No automatic hooks or CI — set up manually with `hivelore install-hooks` and `hivelore init --with-ci`
106
+ - Full control over when knowledge becomes team policy
107
+
108
+ **What it creates:**
109
+
110
+ ```
111
+ your-project/
112
+ ├── .ai/
113
+ │ ├── project-context.md # Shared project overview (fill via bootstrap_project MCP prompt)
114
+ │ ├── haive.config.json # Autopilot settings
115
+ │ ├── modules/ # Per-component context files
116
+ │ └── memories/
117
+ │ ├── personal/ # Private to one developer
118
+ │ ├── team/ # Shared with the whole team (git-committed)
119
+ │ └── module/<name>/ # Scoped to a specific module/component
120
+ ├── CLAUDE.md # Bridge for Claude Code (auto-generated)
121
+ ├── AGENTS.md / GEMINI.md / … # 12 native bridges total (Cursor, Cline, Windsurf,
122
+ │ # Continue, Cody, Zed, Roo, Aider, Copilot…)
123
+ └── .github/
124
+ └── copilot-instructions.md # Bridge for GitHub Copilot (auto-generated)
125
+ ```
126
+
127
+ Each bridge carries the repo's validated memories **and** block sensors — not just an empty template —
128
+ so the enforcement edge travels to non-MCP agents too. Regenerate with `hivelore bridges sync`; scope with
129
+ `hivelore init --bridge-targets cursor,copilot`. Bridge files include mandatory rules, but they are not the
130
+ enforcement boundary. Hivelore's portable enforcement comes from MCP policy, Git hooks, CI checks, and `hivelore run -- <agent>` for CLI agents.
131
+
132
+ `hivelore init` also runs agent-aware setup. It always writes project-level MCP configs and records the selected mode in `.ai/.runtime/enforcement/agent-mode.json`. When it needs to change user-level configs such as Cursor, Claude Code, VS Code, Windsurf, or Codex, it asks for confirmation in an interactive shell. In CI/non-interactive shells, re-run:
133
+
134
+ ```bash
135
+ hivelore agent setup --yes
136
+ ```
137
+
138
+ ### `hivelore agent`
139
+
140
+ Detect and configure the best Hivelore mode for the current machine.
141
+
142
+ ```bash
143
+ hivelore agent detect # inspect project MCP + installed agents
144
+ hivelore agent status # same report, human-readable or --json
145
+ hivelore agent setup # project MCP + optional global MCP setup
146
+ hivelore agent setup --no-global # project-only setup, no user config writes
147
+ hivelore agent setup --yes # approve user-level MCP config writes
148
+ ```
149
+
150
+ Modes:
151
+
152
+ - `mcp`: native Hivelore tools are available through the AI client.
153
+ - `wrapped`: use `hivelore run -- <agent>` when native MCP is unavailable.
154
+ - `fallback`: use `hivelore briefing` and `hivelore enforce check` manually.
155
+
156
+ ---
157
+
158
+ ### `hivelore enforce`
159
+
160
+ Install and run the agent-agnostic policy gates.
161
+
162
+ ```bash
163
+ hivelore enforce install # strict config + Git hooks + CI + supported client hooks
164
+ hivelore enforce status # show whether the repo is protected
165
+ hivelore enforce check --stage local # local policy gate
166
+ hivelore enforce check --stage pre-push # used by Git hooks
167
+ hivelore enforce ci # used by required CI checks
168
+ hivelore enforce finish # final agent-exit gate: commit/push + version/tag protocol
169
+ hivelore enforce cleanup # remove generated .ai runtime/cache artifacts
170
+ ```
171
+
172
+ Strict mode checks for:
173
+
174
+ - a recent Hivelore briefing marker before local write workflows
175
+ - recent session recap before push/CI gates
176
+ - stale important memories anchored to changed code
177
+ - decision coverage: changed files must have their relevant anchored policies surfaced in the latest briefing
178
+ - known anti-patterns from validated gotchas/decisions
179
+ - visible generated artifacts such as `.ai/.runtime`, `.ai/.cache`, or Python bytecode
180
+ - completed work is committed/pushed; shippable package changes have lockstep version bump + git tag
181
+
182
+ `hivelore enforce check` prints an enforcement score and fails strict gates when the score drops below the configured threshold.
183
+
184
+ ### `hivelore sensors`
185
+
186
+ Operate executable regex sensors stored on `gotcha`/`attempt` memories.
187
+
188
+ ```bash
189
+ hivelore sensors list
190
+ hivelore sensors check # scans git diff --cached
191
+ hivelore sensors check --diff-file diff.patch --json
192
+ hivelore sensors promote <memory-id> --yes
193
+ hivelore sensors export --format grep
194
+ ```
195
+
196
+ Autogenerated sensors are conservative: they start as `warn` and `autogen: true`. A human can promote
197
+ high-confidence sensors to `severity: block`, which makes a deterministic pre-commit blocker when the
198
+ sensor matches added diff lines.
199
+
200
+ ### `hivelore ingest`
201
+
202
+ Seed proposed, anchored memories (with sensors) from scanner output, so a fresh repo has policy from
203
+ day one instead of an empty corpus.
204
+
205
+ ```bash
206
+ hivelore ingest --from sonar issues.json --min-severity major
207
+ hivelore ingest --from sarif report.sarif
208
+ hivelore ingest --from eslint eslint-report.json
209
+ hivelore ingest --from npm-audit audit.json --scope team
210
+ hivelore ingest --from sonar-api --sonar-component my_project # pull straight from SonarQube
211
+ hivelore ingest --from sarif report.sarif --dry-run # preview without writing
212
+ ```
213
+
214
+ A **quality floor** runs by default: auto-fixable stylistic rules (semi/quotes/indent/prefer-const/
215
+ prettier… and the equivalent Sonar numeric keys) are dropped as linter-autofix noise, not lessons. Pass
216
+ `--include-stylistic` to keep them. Created memories are `proposed` with warn-only sensors — review with
217
+ `hivelore memory list --status proposed` and promote vetted sensors with `hivelore sensors promote`.
218
+
219
+ ### `hivelore coverage`
220
+
221
+ Find changed files that no memory covers — the blind spots in your corpus.
222
+
223
+ ```bash
224
+ hivelore coverage # cross corpus with git churn + agent-edited hot files
225
+ hivelore coverage --source git # only committed churn
226
+ hivelore coverage --source agent # only files agents edited (PostToolUse observation log)
227
+ ```
228
+
229
+ ### `hivelore eval`
230
+
231
+ Run the repeatable quality gate for Hivelore itself or for a project using Hivelore:
232
+
233
+ ```bash
234
+ hivelore eval
235
+ hivelore eval --semantic-only
236
+ hivelore eval --spec .ai/eval/spec.json --fail-under 80
237
+ ```
238
+
239
+ Without `--spec`, Hivelore synthesizes retrieval cases from anchored memories. If `.ai/eval/spec.json`
240
+ exists, it is loaded automatically and merged with those synthesized retrieval cases. Use that file
241
+ for labeled sensor cases and hard retrieval probes so CI measures both “did the right memory surface?”
242
+ and “did the executable guardrail fire?”.
243
+
244
+ ### `hivelore doctor`
245
+
246
+ `doctor` is the first stop when Hivelore feels inconsistent locally:
247
+
248
+ ```bash
249
+ hivelore doctor
250
+ hivelore doctor --json
251
+ hivelore doctor --fix
252
+ ```
253
+
254
+ It reports missing `pnpm`, stale workspace `dist` artifacts after a pull, global CLI/MCP version skew,
255
+ outdated code-search indexes, memory-lint findings, and harness coverage. The output is intentionally
256
+ actionable: every setup finding should carry the exact command to run next.
257
+
258
+ ### `hivelore benchmark`
259
+
260
+ Turn Hivelore-vs-plain agent trials into a repeatable demo/report.
261
+
262
+ ```bash
263
+ hivelore benchmark demo
264
+ hivelore benchmark report --dir benchmarks/agent-benchmark
265
+ hivelore benchmark report --dir benchmarks/agent-benchmark --out RESULTS.md
266
+ ```
267
+
268
+ The report summarizes agent effort from `BENCHMARK_AGENT_REPORT.md` files: commands, files read, files modified, test iterations, terminal failures, decision mentions, token proxy, and whether Hivelore memory shaped the outcome.
269
+
270
+ ### `hivelore run`
271
+
272
+ Wrap any CLI-based coding agent in a Hivelore session.
273
+
274
+ ```bash
275
+ hivelore run -- claude
276
+ hivelore run -- codex
277
+ hivelore run -- aider
278
+ hivelore run -- <custom-agent> [args...]
279
+ ```
280
+
281
+ The wrapper writes a compact briefing file and exports:
282
+
283
+ - `HAIVE_PROJECT_ROOT`
284
+ - `HAIVE_SESSION_ID`
285
+ - `HAIVE_BRIEFING_FILE`
286
+ - `HAIVE_ENFORCEMENT=strict`
287
+ - `HAIVE_TOOL_PROFILE=enforcement`
288
+
289
+ ---
290
+
291
+ ### `hivelore mcp`
292
+
293
+ Run the Hivelore MCP server over stdio (**bundled into this package** — same tools as legacy `haive-mcp`).
294
+
295
+ ```bash
296
+ hivelore mcp --stdio # typical MCP client args (stdio marker optional but recommended)
297
+ hivelore mcp -d /path/to/project # resolve project root from this directory
298
+ hivelore mcp --root /path/to/project # alias for legacy haive-mcp --root
299
+ ```
300
+
301
+ **Claude Code** (`~/.claude.json`):
302
+ ```json
303
+ {
304
+ "mcpServers": {
305
+ "hivelore": {
306
+ "command": "hivelore",
307
+ "args": ["mcp", "--stdio", "--root", "/absolute/path/to/your/project"]
308
+ }
309
+ }
310
+ }
311
+ ```
312
+
313
+ **Cursor** (`~/.cursor/mcp.json`):
314
+ ```json
315
+ {
316
+ "mcpServers": {
317
+ "hivelore": {
318
+ "command": "hivelore",
319
+ "args": ["mcp", "--stdio", "--root", "/absolute/path/to/your/project"]
320
+ }
321
+ }
322
+ }
323
+ ```
324
+
325
+ **VS Code**:
326
+ ```bash
327
+ code --add-mcp '{"name":"haive","command":"haive","args":["mcp","--stdio","--root","/path/to/project"]}'
328
+ ```
329
+
330
+ ---
331
+
332
+ ### `hivelore memory`
333
+
334
+ Manage individual memory entries.
335
+
336
+ #### `hivelore memory save`
337
+
338
+ (Canonical verb; `hivelore memory add` remains as an alias.)
339
+
340
+ ```bash
341
+ hivelore memory save \
342
+ --type <type> \ # convention | decision | gotcha | architecture | glossary | attempt
343
+ --slug <slug> \ # Short identifier used in the filename
344
+ --scope team \ # personal (default) | team | module
345
+ --title "My title" \ # Optional heading (auto-added to body)
346
+ --tags "auth,jwt" \ # Comma-separated tags
347
+ --domain payments \ # Business domain for relevance scoring
348
+ --paths src/auth.ts \ # Anchor to files (enables staleness detection)
349
+ --symbols JwtFilter \ # Anchor to symbols/functions
350
+ --body "The knowledge." # Memory content (Markdown)
351
+
352
+ # Read body from a file (useful for long memories):
353
+ hivelore memory save --type architecture --slug "payment-flow" \
354
+ --body-file docs/payment-architecture.md
355
+ ```
356
+
357
+ **Memory types:**
358
+
359
+ | Type | When to use |
360
+ |---|---|
361
+ | `convention` | How things are done here: naming, patterns, workflow |
362
+ | `decision` | A choice that was made and WHY (tradeoffs, constraints) |
363
+ | `gotcha` | Non-obvious behavior, traps, things that surprise newcomers |
364
+ | `architecture` | Structural overview of a system or module |
365
+ | `glossary` | Domain terms and their meaning in this project |
366
+ | `attempt` | Failed approach — prevents the same mistake next session |
367
+
368
+ #### `hivelore memory list`
369
+
370
+ ```bash
371
+ hivelore memory list # All memories
372
+ hivelore memory list --scope team # Team memories only
373
+ hivelore memory list --status validated # Only validated
374
+ hivelore memory list --type gotcha # Gotchas only
375
+ hivelore memory list --tags auth,jwt # By tags (AND match)
376
+ hivelore memory list --module payments # Module-scoped memories
377
+ ```
378
+
379
+ #### `hivelore memory search`
380
+
381
+ Full-text (or semantic) search across id, tags, and body. (`hivelore memory query` remains as an alias.)
382
+
383
+ ```bash
384
+ hivelore memory search "flyway migration" # AND search across all tokens
385
+ hivelore memory search "payment mobile wave" # Falls back to OR if no AND match
386
+ hivelore memory search "jwt" --scope team --limit 5
387
+ ```
388
+
389
+ #### `hivelore memory get`
390
+
391
+ Print the full body, frontmatter, and usage stats of a memory. (`hivelore memory show` remains as an alias.)
392
+
393
+ ```bash
394
+ hivelore memory get 2025-01-15-gotcha-flyway-strict
395
+ ```
396
+
397
+ #### `hivelore memory update`
398
+
399
+ Update a memory's body, tags, or anchor without changing its id or history.
400
+
401
+ ```bash
402
+ hivelore memory update <id> --body "Updated content."
403
+ hivelore memory update <id> --tags "auth,jwt,security"
404
+ hivelore memory update <id> --paths src/auth.ts,src/jwt.ts
405
+ ```
406
+
407
+ #### `hivelore memory verify`
408
+
409
+ Check anchor freshness — detect stale memories when anchored files or symbols have moved.
410
+
411
+ ```bash
412
+ hivelore memory verify # Check all memories
413
+ hivelore memory verify --id <id> # Check a specific one
414
+ hivelore memory verify --update # Write stale/validated status back to disk
415
+ ```
416
+
417
+ When a file is missing, Hivelore searches the project for files with the same basename and suggests possible renames.
418
+
419
+ #### `hivelore memory approve` / `promote` / `reject`
420
+
421
+ Control the memory lifecycle: `draft → proposed → validated` or `rejected`.
422
+
423
+ ```bash
424
+ hivelore memory approve <id> # Mark as validated
425
+ hivelore memory approve --all # Bulk-approve all proposed/draft
426
+ hivelore memory promote <id> # Promote personal → team (status: proposed)
427
+ hivelore memory reject <id> --reason "Outdated after refactor"
428
+ ```
429
+
430
+ #### `hivelore memory tried`
431
+
432
+ Record a failed approach — the most valuable type of negative knowledge.
433
+
434
+ ```bash
435
+ hivelore memory tried \
436
+ --what "importing gray-matter with ESM dynamic import" \
437
+ --why-failed "gray-matter doesn't export a default; named import required" \
438
+ --instead "import matter from 'gray-matter'" \
439
+ --scope team \
440
+ --paths src/parser.ts
441
+ ```
442
+
443
+ Auto-validated (no approval cycle needed). Surfaced first in `get_briefing` so agents see it before making the same mistake.
444
+
445
+ #### `hivelore memory import`
446
+
447
+ Import documentation (README, ADR, wiki page) as memories via the `import_docs` MCP prompt.
448
+
449
+ ```bash
450
+ hivelore memory import --from docs/architecture.md --scope team
451
+ ```
452
+
453
+ Prints the MCP `import_docs` invocation to run in your AI client.
454
+
455
+ #### `hivelore memory for-files`
456
+
457
+ Show memories relevant to specific files you're about to edit.
458
+
459
+ ```bash
460
+ hivelore memory for-files src/payments/PaymentService.java src/payments/PaymentController.java
461
+ ```
462
+
463
+ #### `hivelore memory stats` / `hot` / `pending` / `digest`
464
+
465
+ ```bash
466
+ hivelore memory stats # Usage stats and confidence levels for all memories
467
+ hivelore memory hot # Most-read unvalidated memories (good promotion candidates)
468
+ hivelore memory pending # Proposed memories awaiting review
469
+
470
+ # Generate a Markdown review digest for bulk approval/rejection:
471
+ hivelore memory digest # Last 7 days, team scope (prints to stdout)
472
+ hivelore memory digest --days 14 # Last 14 days
473
+ hivelore memory digest --scope all # All scopes
474
+ hivelore memory digest --out digest.md # Write to file
475
+ ```
476
+
477
+ The digest groups memories by type, shows confidence level (⬜ unverified / 🟡 low / 🟢 trusted / ⭐ authoritative), anchor, read count, and action checkboxes for easy bulk review.
478
+
479
+ ---
480
+
481
+ ### `hivelore briefing`
482
+
483
+ Print the full project briefing — project context + relevant memories — in one shot. Use before starting a task.
484
+
485
+ ```bash
486
+ hivelore briefing # Full briefing, team scope
487
+ hivelore briefing --task "add a Stripe payment" # Filter by task relevance
488
+ hivelore briefing --files src/payments/PaymentService.java # Filter by files
489
+ hivelore briefing --symbols PaymentService,TenantFilter # Look up symbol locations in code-map
490
+ hivelore briefing --scope all # Include personal memories
491
+ hivelore briefing --include-stale # Include stale memories
492
+ hivelore briefing --max-memories 15 # Show more memories
493
+ ```
494
+
495
+ **`--symbols` (requires `hivelore index code`):** look up where specific symbols are defined across your entire codebase — no grep needed. Returns file, line number, kind (class/interface/function/enum), and JSDoc description for each match.
496
+
497
+ ```
498
+ PaymentProvider src/payments/PaymentProvider.java:12 [interface] — Abstract payment provider
499
+ PaymentProvider src/frontend/payment.types.ts:4 [enum] — Mobile payment provider enum
500
+ ```
501
+
502
+ ---
503
+
504
+ ### `hivelore sync`
505
+
506
+ Refresh memory state after a `git pull` or merge.
507
+
508
+ ```bash
509
+ hivelore sync # Verify anchors + auto-promote eligible memories
510
+ hivelore sync --since main # Report memories changed since main
511
+ hivelore sync --inject-bridge # Inject top memories into CLAUDE.md
512
+ hivelore sync --embed # Rebuild embeddings index after sync
513
+ hivelore sync --quiet # Minimal output (for git hooks)
514
+ ```
515
+
516
+ **What sync does:**
517
+ 1. Checks every anchored memory: does the file/symbol still exist? → marks `stale` if not
518
+ 2. Re-validates previously stale memories that are now fresh again
519
+ 3. Auto-promotes `proposed` memories that have been read enough times
520
+ 4. Reports a decay warning for memories not read in >90 days
521
+ 5. Optionally injects the top validated memories into your CLAUDE.md
522
+
523
+ ---
524
+
525
+ ### `hivelore install-hooks`
526
+
527
+ Install git hooks so `hivelore sync` runs automatically after every pull/merge.
528
+
529
+ ```bash
530
+ hivelore install-hooks # Install post-merge and post-rewrite hooks
531
+ hivelore install-hooks --dir /path/to/project
532
+ ```
533
+
534
+ ---
535
+
536
+ ### `hivelore embeddings`
537
+
538
+ Manage the local semantic search index (requires `@hivelore/embeddings` to be installed).
539
+
540
+ ```bash
541
+ hivelore embeddings index # Build or refresh the embeddings index
542
+ hivelore embeddings status # Show index stats (count, last updated, model)
543
+ hivelore embeddings query "how do we handle retries on payment failures"
544
+ ```
545
+
546
+ The model (`bge-small-en-v1.5`, ~110MB) is downloaded on first use and cached locally. **No data leaves your machine.**
547
+
548
+ ---
549
+
550
+ ### `hivelore index`
551
+
552
+ Build code navigation indexes.
553
+
554
+ ```bash
555
+ hivelore index code # Build .ai/code-map.json (file → exports + 1-line descriptions)
556
+ ```
557
+
558
+ The code map lets AI agents find where a function lives without grepping — dramatically reducing tool calls at the start of a task.
559
+
560
+ ---
561
+
562
+ ### `hivelore tui`
563
+
564
+ Interactive terminal dashboard with 3 screens — browse, filter, and manage memories without leaving the terminal.
565
+
566
+ ```bash
567
+ hivelore tui # Open the TUI
568
+ hivelore tui --dir /path/to/project
569
+ ```
570
+
571
+ **Screens (switch with `1` `2` `3`):**
572
+
573
+ | Screen | Key | What it shows |
574
+ |---|---|---|
575
+ | Memories | `1` | Full list + preview panel, filter by status (Tab), actions |
576
+ | Health | `2` | Stale memories, pending review, anchorless memories |
577
+ | Stats | `3` | Top-read memories, decaying (>90d unused), totals by status |
578
+
579
+ **Actions (in Memories screen):**
580
+
581
+ | Key | Action |
582
+ |---|---|
583
+ | `↑` `↓` | Navigate |
584
+ | `Tab` | Cycle filter (all / draft / proposed / validated / stale / rejected) |
585
+ | `a` | Approve (→ validated) |
586
+ | `r` | Reject |
587
+ | `p` | Propose (→ proposed) |
588
+ | `d` | Delete |
589
+ | `q` | Quit |
590
+
591
+ ---
592
+
593
+ ### `hivelore session end`
594
+
595
+ Save a structured end-of-session recap. Surfaced automatically at the start of the next session via `get_briefing`.
596
+
597
+ ```bash
598
+ hivelore session end \
599
+ --goal "Add Stripe payment integration" \
600
+ --accomplished "Implemented PaymentService, added tests, deployed to staging" \
601
+ --discoveries "The webhook signature must use the raw request body, not parsed JSON" \
602
+ --files "src/payments/PaymentService.ts,src/payments/webhook.ts" \
603
+ --next "Add retry logic for failed webhooks" \
604
+ --scope team
605
+ ```
606
+
607
+ One recap is kept per scope (topic-upsert: `revision_count` increments on each call).
608
+
609
+ ---
610
+
611
+ ## Memory lifecycle
612
+
613
+ ```
614
+ hivelore memory save → status: draft
615
+ hivelore memory promote → status: proposed (personal → team)
616
+ hivelore memory approve → status: validated
617
+ hivelore sync → status: stale (if anchor broken)
618
+ hivelore memory reject → status: rejected
619
+ ```
620
+
621
+ Validated team memories are loaded into every `get_briefing` call and injected into bridge files.
622
+
623
+ ---
624
+
625
+ ## Multi-component projects
626
+
627
+ For projects with frontend + backend (or microservices), create one module context per component:
628
+
629
+ ```bash
630
+ # After hivelore init, create module context files:
631
+ mkdir -p .ai/modules/backend .ai/modules/frontend
632
+
633
+ cat > .ai/modules/backend/context.md << 'EOF'
634
+ # Module: backend
635
+ - Spring Boot, Java 17, PostgreSQL
636
+ - Always filter by tenantId in every query
637
+ - Never modify existing Flyway migrations
638
+ EOF
639
+
640
+ cat > .ai/modules/frontend/context.md << 'EOF'
641
+ # Module: frontend
642
+ - React 19, TypeScript, TanStack Query
643
+ - All API calls go through hooks in features/<domain>/api/
644
+ - Env vars must be prefixed with VITE_
645
+ EOF
646
+ ```
647
+
648
+ `get_briefing` auto-loads the relevant module context based on the files the agent is editing.
649
+
650
+ ---
651
+
652
+ ## Semantic search (optional)
653
+
654
+ Install `@hivelore/embeddings` for similarity-based memory retrieval:
655
+
656
+ ```bash
657
+ npm install -g @hivelore/embeddings
658
+ hivelore embeddings index # First run downloads the model (~110MB)
659
+ hivelore embeddings query "payment retry logic"
660
+ ```
661
+
662
+ From MCP: set `semantic: true` on `mem_search` or `get_briefing`.
663
+
664
+ ---
665
+
666
+ ## License
667
+
668
+ MIT