Skip to content

Commit 4727371

Browse files
committed
separate CLI hook installation
1 parent 5b969df commit 4727371

8 files changed

Lines changed: 530 additions & 652 deletions

File tree

‎README.md‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,23 @@ The skill preserves three evidence levels:
9595

9696
### Skills and hooks
9797

98-
`install` may place CLI-first skills, durable instructions, and compatible lifecycle/context hooks for detected coding agents. New installs do **not** create MCP registrations or MCP-bound tier profiles/extensions.
98+
`install` may place CLI-first skills and durable instructions for detected coding agents. It **never installs hooks** and does not create, migrate, or remove `codebase-memory-mcp` registrations or MCP-owned assets.
99+
100+
Hooks are a separate, explicit opt-in surface. Install only `codebase-memory-cli`-owned lifecycle/context hooks with:
101+
102+
```sh
103+
codebase-memory-cli install-hooks
104+
```
99105

100106
Hooks are an optimization and guidance surface, not the only route to the graph. If a warm runtime is absent or a hook cannot augment context, it fails open and the ordinary CLI still works.
101107

102-
To configure detected agent integrations without replacing an externally managed binary:
108+
To configure detected agent assets without replacing an externally managed binary:
103109

104110
```sh
105111
codebase-memory-cli install --skip-binary
106112
```
107113

108-
Use `install --plan` when you want to inspect planned writes before applying them.
114+
Use `install --plan` to inspect asset writes and `install-hooks --plan` to inspect hook writes before applying either surface. `--clients=<list>` is supported independently by both commands.
109115

110116
## Installation
111117

@@ -132,7 +138,7 @@ Windows PowerShell:
132138
irm https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/scripts/setup-windows.ps1 | iex
133139
```
134140

135-
The setup scripts install the executable. They do not write MCP client configuration. Afterward, run `codebase-memory-cli install --skip-binary` if you want Codebase Memory to install its CLI-first skills/instructions/hooks for detected agents.
141+
The setup scripts install the executable. They do not install hooks or write MCP client configuration. Afterward, run `codebase-memory-cli install --skip-binary` for CLI-first skills/instructions. Run `codebase-memory-cli install-hooks` separately only if you explicitly want CLI-owned agent hooks.
136142

137143
## Human and machine output
138144

‎docs/CLI_MIGRATION_STATUS.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,3 +342,13 @@ Status: **IMPLEMENTED / REQUIRES EXTERNAL RERUN**
342342
- **VERIFIED LOCALLY:** changed production/test objects compile under the repository's strict production and ASan/UBSan warning policies. Full incremental execution still requires the externally cached FastAPI fixture unavailable in this sandbox.
343343
- **PENDING EXTERNAL GATE:** run `scripts/test.sh` once on CP77. No separate memory-analysis rerun is required unless new memory evidence appears.
344344

345+
346+
### CP78 — Explicit CLI hook-install boundary and MCP coexistence
347+
348+
- **COMPLETE (implementation):** ordinary `codebase-memory-cli install` is an asset-only surface. CLI-owned agent hooks require the separate, explicit `codebase-memory-cli install-hooks` command; `--plan`, `--dry-run`, and `--clients` are independently supported on that hook surface.
349+
- **COMPLETE:** CLI-owned durable-context assets and hook identities use `codebase-memory-cli` namespaces rather than MCP-era names. The CLI no longer adopts MCP-era Claude/Gemini hook identities as upgrade ownership.
350+
- **COMPLETE:** install, hook installation, and uninstall treat `codebase-memory-mcp` registrations, MCP-era hook files, legacy MCP compaction labels, and MCP-owned skill namespaces as foreign. Side-by-side installation therefore does not use MCP cleanup as a migration mechanism.
351+
- **COMPLETE:** setup scripts no longer activate repository Git hooks implicitly. Post-install guidance makes agent-hook installation explicitly opt-in.
352+
- **REGRESSION COVERAGE ADDED:** CP78 plan tests assert that asset and hook plans are disjoint, and a Claude coexistence test asserts that explicit CLI hook installation preserves a pre-existing MCP hook command/file while installing separate CLI hook identities.
353+
- **VERIFIED LOCALLY:** changed production CLI and CLI-test translation units compile with the repository's strict `-Wall -Wextra -Werror` production/test policies and ASan/UBSan test instrumentation.
354+
- **PENDING EXTERNAL GATE:** the full sanitizer runner could not be linked within the bounded local compiler windows because the repository-wide grammar/dependency build repeatedly exhausted the command window. No CP78 compile failure surfaced. Run the canonical Jenkins/`scripts/test.sh` gate on the CP78 candidate; reconcile any stale pre-CP78 ownership assertions rather than weakening the MCP/CLI separation contract.

‎scripts/setup-windows.ps1‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@ function Write-Warn($msg) { Write-Host " $msg" -ForegroundColor Yellow }
2222
function Write-AgentIntegrationGuidance($Command) {
2323
Write-Host ""
2424
Write-Host " Codebase Memory is CLI-first; this setup script does not write MCP client configuration." -ForegroundColor White
25-
Write-Host " To install CLI-first skills/instructions/hooks for detected agents, run:" -ForegroundColor White
25+
Write-Host " To install CLI-first skills/instructions for detected agents, run:" -ForegroundColor White
2626
Write-Host ""
2727
Write-Host " $Command install --skip-binary" -ForegroundColor Yellow
28+
Write-Host ""
29+
Write-Host " Hooks are never installed by setup or install. To opt in separately, run:" -ForegroundColor White
30+
Write-Host ""
31+
Write-Host " $Command install-hooks" -ForegroundColor Yellow
2832
}
2933

3034

‎scripts/setup.sh‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,13 @@ build_from_source() {
209209
print_agent_integration_guidance() {
210210
echo ""
211211
info "Codebase Memory is CLI-first; this setup script does not write MCP client configuration."
212-
info "To install CLI-first skills/instructions/hooks for detected agents, run:"
212+
info "To install CLI-first skills/instructions for detected agents, run:"
213213
echo ""
214214
echo " ${INSTALL_DIR}/${BINARY_NAME} install --skip-binary"
215+
echo ""
216+
info "Hooks are never installed by setup or install. To opt in separately, run:"
217+
echo ""
218+
echo " ${INSTALL_DIR}/${BINARY_NAME} install-hooks"
215219
}
216220

217221
# --- PATH check ---
@@ -257,12 +261,8 @@ fi
257261
print_agent_integration_guidance
258262
check_path
259263

260-
# --- Git hooks ---
261-
# If run from inside the repo, activate tracked hooks
262-
if [ -d "scripts/hooks" ] && git rev-parse --git-dir &>/dev/null; then
263-
git config core.hooksPath scripts/hooks
264-
ok "Git hooks activated (scripts/hooks/)"
265-
fi
264+
# Hook installation is intentionally never implicit. Repository contributors may
265+
# opt into tracked Git hooks separately with: git config core.hooksPath scripts/hooks
266266

267267
echo ""
268268
ok "Done! Try: ${BINARY_NAME} --help"

0 commit comments

Comments
 (0)