@hiveai/cli 0.9.9 → 0.9.11

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,8 +1,10 @@
1
1
  # @hiveai/cli
2
2
 
3
- > **hAIve** — team-first persistent memory layer for AI coding agents.
3
+ > **hAIve** — policy enforcement for AI coding agents.
4
4
 
5
- Stop re-explaining your project to every AI session. hAIve stores your team's conventions, architectural decisions, gotchas, and discovered patterns as version-controlled Markdown files. Every AI tool on your team reads the same shared knowledge automatically via the MCP server, bridge files (CLAUDE.md, .cursorrules, Copilot instructions), or the CLI directly.
5
+ hAIve makes your team knowledge enforceable. 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.
6
+
7
+ The memory system is the mechanism. The CLI is the control plane: initialize policy, run agents inside hAIve, check the repo, and block unsafe workflow states.
6
8
 
7
9
  ---
8
10
 
@@ -23,31 +25,33 @@ This installs the `haive` command globally. **The MCP server is bundled** — us
23
25
  ## Quick start
24
26
 
25
27
  ```bash
26
- # 1. Initialize hAIve in your project (autopilot ON by default)
28
+ # 1. Initialize hAIve in your project (strict enforcement ON by default)
27
29
  cd my-project
28
- haive init # autopilot: hooks + CI + code-map auto-configured
29
- # haive init --manual # if you prefer to approve memories yourself
30
+ haive init # .ai/, MCP config, hooks, CI, code-map
31
+ haive enforce install # re-apply strict MCP + Git + CI enforcement gates
30
32
 
31
33
  # 2. Point your AI client at the MCP server
32
34
  # Add to ~/.claude.json / ~/.cursor/mcp.json:
33
35
  # { "mcpServers": { "haive": { "command": "haive", "args": ["mcp", "--stdio", "--root", "/absolute/path"] } } }
34
36
 
35
- # 3. Bootstrap the project context (run once in your AI client)
37
+ # 3. Bootstrap project context (run once in your AI client)
36
38
  # → Use the bootstrap_project MCP prompt to analyze the codebase and fill .ai/project-context.md
37
39
 
38
- # 4. Your AI client now calls get_briefing at every session start — zero config needed
40
+ # 4. Start work through hAIve
41
+ haive briefing --task "add Stripe webhook"
42
+ haive run -- <agent-command> [args...] # for CLI agents without blocking hooks
39
43
 
40
- # 5. Add a memory manually (or let the AI agent do it via mem_save)
44
+ # 5. Add durable policy knowledge manually (or let the agent use mem_save/mem_tried)
41
45
  haive memory add \
42
46
  --type gotcha --slug "jpa-open-in-view" --scope team \
43
47
  --paths src/main/resources/application.properties \
44
48
  --body "spring.jpa.open-in-view=false is intentional — do not re-enable."
45
49
 
46
- # 6. Browse and manage memories in the TUI dashboard
47
- haive tui
48
-
49
- # 7. Sync after a git pull (runs automatically via hooks in autopilot mode)
50
- haive sync
50
+ # 6. Gate the workflow
51
+ haive enforce status
52
+ haive enforce check --stage pre-commit
53
+ haive enforce ci
54
+ haive benchmark report --dir benchmarks/agent-benchmark
51
55
  ```
52
56
 
53
57
  ---
@@ -56,10 +60,10 @@ haive sync
56
60
 
57
61
  ### `haive init`
58
62
 
59
- Initialize the `.ai/` structure in a project. **Autopilot mode is ON by default** zero manual steps required.
63
+ Initialize the `.ai/` structure in a project. **Autopilot mode is ON by default** and now installs strict enforcement gates by default.
60
64
 
61
65
  ```bash
62
- haive init # Autopilot: validates memories automatically, installs hooks, builds code-map
66
+ haive init # Autopilot: policy config, hooks, CI, MCP setup, code-map
63
67
  haive init --manual # Manual mode: you approve every memory yourself
64
68
  haive init --no-bridges # Skip bridge file generation (CLAUDE.md, .cursorrules, etc.)
65
69
  haive init --dir /other/path # Initialize in a specific directory
@@ -67,8 +71,8 @@ haive init --dir /other/path # Initialize in a specific directory
67
71
 
68
72
  **Autopilot mode** (default):
69
73
  - Memories are saved directly as `validated` (no approval cycle)
70
- - Git hooks installed automatically (`haive sync` after every pull)
71
- - CI workflow generated (`.github/workflows/haive-sync.yml`)
74
+ - Git hooks installed automatically (`haive enforce check` gates commits/pushes)
75
+ - CI workflows generated (`haive-enforcement.yml` and sync workflow)
72
76
  - Initial code-map built (`.ai/code-map.json`) for symbol lookup
73
77
  - Session recaps saved automatically when the MCP server exits
74
78
  - Configuration stored in `.ai/haive.config.json`
@@ -76,7 +80,7 @@ haive init --dir /other/path # Initialize in a specific directory
76
80
  **Manual mode** (`--manual`):
77
81
  - Memories start as `proposed` and require explicit approval (`haive memory approve`)
78
82
  - No automatic hooks or CI — set up manually with `haive install-hooks` and `haive init --with-ci`
79
- - Full control over when knowledge is shared with the team
83
+ - Full control over when knowledge becomes team policy
80
84
 
81
85
  **What it creates:**
82
86
 
@@ -96,7 +100,64 @@ your-project/
96
100
  └── copilot-instructions.md # Bridge for GitHub Copilot (auto-generated)
97
101
  ```
98
102
 
99
- Bridge files include mandatory rules that tell agents to call `post_task` and `mem_tried` before closing a session, so knowledge is captured automatically.
103
+ Bridge files include mandatory rules, but they are not the enforcement boundary. hAIve's portable enforcement comes from MCP policy, Git hooks, CI checks, and `haive run -- <agent>` for CLI agents.
104
+
105
+ ---
106
+
107
+ ### `haive enforce`
108
+
109
+ Install and run the agent-agnostic policy gates.
110
+
111
+ ```bash
112
+ haive enforce install # strict config + Git hooks + CI + supported client hooks
113
+ haive enforce status # show whether the repo is protected
114
+ haive enforce check --stage local # local policy gate
115
+ haive enforce check --stage pre-push # used by Git hooks
116
+ haive enforce ci # used by required CI checks
117
+ haive enforce cleanup # remove generated .ai runtime/cache artifacts
118
+ ```
119
+
120
+ Strict mode checks for:
121
+
122
+ - a recent hAIve briefing marker before local write workflows
123
+ - recent session recap before push/CI gates
124
+ - stale important memories anchored to changed code
125
+ - decision coverage: changed files must have their relevant anchored policies surfaced in the latest briefing
126
+ - known anti-patterns from validated gotchas/decisions
127
+ - visible generated artifacts such as `.ai/.runtime`, `.ai/.cache`, or Python bytecode
128
+
129
+ `haive enforce check` prints an enforcement score and fails strict gates when the score drops below the configured threshold.
130
+
131
+ ### `haive benchmark`
132
+
133
+ Turn hAIve-vs-plain agent trials into a repeatable demo/report.
134
+
135
+ ```bash
136
+ haive benchmark demo
137
+ haive benchmark report --dir benchmarks/agent-benchmark
138
+ haive benchmark report --dir benchmarks/agent-benchmark --out RESULTS.md
139
+ ```
140
+
141
+ 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 hAIve memory shaped the outcome.
142
+
143
+ ### `haive run`
144
+
145
+ Wrap any CLI-based coding agent in a hAIve session.
146
+
147
+ ```bash
148
+ haive run -- claude
149
+ haive run -- codex
150
+ haive run -- aider
151
+ haive run -- <custom-agent> [args...]
152
+ ```
153
+
154
+ The wrapper writes a compact briefing file and exports:
155
+
156
+ - `HAIVE_PROJECT_ROOT`
157
+ - `HAIVE_SESSION_ID`
158
+ - `HAIVE_BRIEFING_FILE`
159
+ - `HAIVE_ENFORCEMENT=strict`
160
+ - `HAIVE_TOOL_PROFILE=enforcement`
100
161
 
101
162
  ---
102
163