Commit Graph
299 Commits
Author SHA1 Message Date
Martin Vogel 6d838982cb test(cli): pin that an archive over the decompression limit is refused
The in-process updater refuses a tar.gz that inflates past 500 MiB, but no
test reached that refusal, and the limit had no seam. A test-only setter,
in the block that already holds the extractor under
CBM_CLI_ENABLE_TEST_API, lowers the limit, so
cli_update_refuses_an_archive_over_the_decompression_limit sees a 1 MiB
archive refused over a 64 KiB limit and accepted under the real one. With
the check removed the test fails on its refusal assertion.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-14 00:47:41 +01:00
Martin Vogel d6dcb3218b Merge origin/main into fix/hook-augment-startup-deadline
Conflicts resolved:

- src/daemon/runtime.h: both sides add test seams at the end of the
  CBM_ENABLE_TEST_SEAMS block. Kept main's connection-cap and HELLO-order
  seams and placed this branch's fingerprint-cache seams after them; the
  branch's added lines are unchanged.
- src/cli/hook_augment.c: kept main's re-arm guard, which opens the
  timeouts log only once and keeps that descriptor. Dropped main's early
  return and breadcrumb formatting after the open: this branch formats
  the breadcrumb before the log path is resolved, so stderr gets it even
  when the log cannot be opened. That formatting runs on every arm, so
  main's re-arm comment now says the text above is refreshed, and the
  #858 header comment now says the breadcrumb also goes to stderr.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-10 23:08:14 +01:00
Martin Vogel e7c205a996 Merge origin/main into agentty-install
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-09 19:18:33 +01:00
Martin Vogel 3b75f6415b Merge origin/main into agentty-install
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-03 22:29:12 +01:00
Martin Vogel 3a897a2d06 Merge origin/main into persistent-install-hook-opt-out
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-03 18:09:41 +01:00
Martin Vogel d681c37d37 Merge branch 'main' into fix/hermes-remover-empty-hooks 2026-11-03 03:46:36 +01:00
Martin Vogel 7e67581448 Merge origin/main into persistent-install-hook-opt-out
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-03 03:04:38 +01:00
Martin Vogel e1be4c4eaf fix(cli): remove the owned Augment scripts under the install-hook opt-out
install --no-hooks and the persisted install_hooks=false preference
removed the Augment SessionStart and PostToolUse view registrations from
~/.augment/settings.json but left the two scripts they pointed at,
~/.augment/hooks/codebase-memory-session.sh and
codebase-memory-coverage.sh (.ps1 on Windows), on disk.

The opt-out now deletes them the way uninstall does. Both paths share
remove_augment_owned_hook_scripts(): each script is rebuilt from the
binary path the install embedded and removed with
cbm_text_remove_owned_document() only on a byte-for-byte match, so a
script the user edited, or a foreign file with the same name, is kept.
Uninstall keeps its error operation names; the opt-out records
session_script_disable and coverage_script_disable. install --hooks
writes both scripts again.

Test: cli_no_hooks_removes_augment_owned_scripts drives the install
command with fake activation ops in a temporary HOME: default install,
--no-hooks (both scripts gone, MCP entry kept), a bare install with the
stored preference (still gone), --hooks (restored), and a user-edited
session script that --no-hooks keeps while it deletes the untouched
coverage script. The test ends on --hooks because the opt-out is process
state that later tests rely on.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-02 18:52:14 +01:00
Martin Vogel e8f0f4a289 fix(cli): accept the emptied hooks: {} mapping in the Hermes hook editor
Removing the only Hermes pre_llm_call hook empties the hooks mapping, and
the mapping editor writes an emptied section as hooks: {} - the same
convention it uses for mcp_servers: {}. The hook sequence editor then
refused that file for both upsert and removal, because it required every
parent on the sequence path to be a block mapping header. On a config
where our hook was the only entry under hooks, install -> uninstall ->
install exited 1, and a repeated uninstall did too.

An exact empty flow mapping on a parent of the sequence path is now read
as that empty mapping, mirroring how the mapping-entry editor already
treats section: {}. Removal is a byte-identical no-op, and upsert expands
the header in place, keeping its comment, the line endings and every
other byte, so a reinstall lands back on the first install byte for
byte. The sequence key itself holding a mapping, any other flow value,
and content nested under the inline mapping stay refused. Hooks written
by the user and every foreign key are left untouched.

Found while finishing #1862: its persisted hook opt-out runs this remover
on every later install, so every Hermes user whose only hook was ours
would have hit the refusal on each install after the first.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-02 18:23:18 +01:00
Martin Vogel ebe26ba2b5 fix(cli): remove the Codex PreToolUse hook under the install-hook opt-out
#2719 added a PreToolUse Bash hook for Codex after this opt-out was
written. In config.toml it lives inside the managed block, which the
opt-out already removes. In hooks.json it is a separate entry beside the
lifecycle pair, and the opt-out removed only the pair, so after
install --no-hooks, and on every later bare install or update that
respects the stored preference, our PreToolUse hook stayed registered.

The --no-hooks branch now also calls cbm_remove_codex_pretool_hooks_json,
the exact-command remover that uninstall uses since #2719. A PreToolUse
hook the user owns is left alone.

Test: cli_no_hooks_removes_codex_pretool_hook drives the real install
dispatch through both hook representations. A default install writes ours
beside a foreign hook; --no-hooks and a bare install with the stored
preference remove ours and keep the foreign hook and the MCP entry; and
--hooks restores ours. Without the fix it fails: ours is still in
hooks.json after --no-hooks.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-02 02:34:09 +01:00
Martin Vogel 5216b70635 test(cli): adapt the no-hooks plan fixture to the Claude detection rule
Since #1180 a bare ~/.claude directory no longer counts as a Claude Code
install. The fixture of cli_no_hooks_plan_covers_every_hook_installer_family
now also writes .claude/settings.json. Without it claude-code drops out of
agents_detected and the test fails on the tree merged with current main.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-02 02:34:09 +01:00
Martin Vogel 1976986f4b Merge origin/main into fm/cbm-worktree-ignore-1
Brings the branch up to main a5b248f47. Eight files conflicted, each a
same-spot insertion where main and this branch added lines next to the
same anchor. Each resolves to the main version plus the change of this
branch:

- src/cli/cli.h, src/cli/cli.c: CBM_CONFIG_IGNORE_WORKTREES and its
  CONFIG_KEYS row next to the new doc_candidates key.
- src/mcp/mcp.c: the index_worktree schema property next to the new
  doc_candidates property.
- README.md, docs/CONFIGURATION.md: the ignore_worktrees line and table
  row next to the rewritten auto_watch entries and the new
  doc_candidates and watch_non_git rows.
- src/git/git_context.c: the env-isolation comment after the new debug
  stage marker, directly above cbm_popen_git.
- src/cli/hook_augment.c: the new SubagentStart cli_hint ahead of the
  parent-graph check of this branch.
- tests/test_mcp.c: both RUN_TEST blocks; main already includes
  str_util.h.

Per file, the lines changed against main equal the changes of this
branch against the merge-base.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-02 02:07:22 +01:00
Martin Vogel 77310d5f6f fix(cli): keep the hook default path untouched while ignore_worktrees is off
The lifecycle hook now reads ignore_worktrees first and does nothing
else for it while the key is off; the project lookup is then the one
the hook did before the key existed.

- cbm_mcp_ignore_worktrees_runtime_enabled() replaces
  cbm_mcp_server_attach_runtime_config(). It never attaches a store to
  the server, which may be the daemon session server. A server with a
  store answers from it. Otherwise the runtime store is opened only to
  read this key, and only when it already exists, so a hook event never
  creates _config.db.
- cwd canonicalization, the linked-worktree probe and the parent-graph
  check moved into ha_resolve_project_ignoring_worktrees(), which runs
  only when the key is on.

Test cli_hook_ignore_worktrees_default_off_does_no_worktree_work was red
on the previous head (a default-off event created _config.db). It also
pins, through a test-API counter, that neither an absent store nor a
store without the key reaches the worktree gate, and that the key on
reaches it once. mcp_ignore_worktrees_runtime_read_leaves_server_and_store_alone
replaces the test of the removed helper.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-02 02:04:15 +01:00
Martin Vogel 1adabd8c57 Merge origin/main into carry/1862-install-hook-optout
Maintainer refresh of #1862 (persistent install-hook opt-out, direction
decided in #753) onto main a5b248f4. The first refresh is 2577a86a and
carries the semantic fixes for shell-free Claude hooks.

Textual conflicts, all resolved by keeping both sides:

- src/cli/cli.h: main added CBM_CONFIG_DOC_CANDIDATES on the line where
  the PR added CBM_CONFIG_INSTALL_HOOKS. Both defines are kept, in
  alphabetical order.

- src/cli/cli.c CONFIG_KEYS[]: main added the watch_non_git row where the
  PR added install_hooks. Main row stays first, followed by the
  install_hooks row.

- src/cli/cli.c Codex hook install: main (#2719) declared pretool_written
  in front of the hooks.json branch the PR prefixed with its --no-hooks
  removal branch. The declaration stays first, then the PR removal
  branch, then main hooks.json and config.toml upsert branches unchanged.

Check: for every file the PR touches, the added and removed lines of the
merged tree against main equal those of the PR against its old base.

No compile-level semantic conflict: no function the PR calls changed its
signature, and the PR re-signs no function main calls. The new Codex
PreToolUse hook from #2719 is gated by the opt-out in the next commit.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-02 01:37:59 +01:00
Martin Vogel 9aa44426f7 Merge origin/main into feat/graph-gate-contract
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-01 07:17:42 +01:00
Martin Vogel 12920dae15 Merge origin/main into feat/codex-skill-location-compat
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-01 03:03:02 +01:00
Martin Vogel 8d9a8e30fe Merge origin/main into fix/2204-opencode-extension-untouched
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-11-01 00:05:31 +01:00
Martin Vogel e7a7a2b44e Merge origin/main into fix/2671-agent-config-symlinks
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-31 20:06:58 +01:00
Martin Vogel ecd2eab93d Merge origin/main into feat/codex-skill-location-compat
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-31 16:38:29 +01:00
Martin Vogel 23c195fd30 Merge origin/main into feat/graph-gate-contract
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-31 16:38:22 +01:00
Martin Vogel 0d1d44b74d Merge origin/main into fix/2204-opencode-extension-untouched
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-31 16:38:15 +01:00
Divakant Pandey b738549097 Merge main and enforce user ownership for directory symlinks in dir_exists
Follow POSIX symlinks in dir_exists() on top of cbm_path_info_utf8() only when
the invoking user owns both the symlink and the target directory it resolves
to. Leave cbm_agent_registry_path_exists() unchanged, guard the POSIX symlink
tests with #ifndef _WIN32, and isolate XDG_CONFIG_HOME for Linux runs.

Refs #2671
2026-10-31 12:26:21 +05:30
Martin Vogel 4787012023 Merge origin/main into fix/2722-install-managed-binary-path
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-31 06:11:22 +01:00
Martin Vogel 2418526e50 Merge origin/main into feat/codex-skill-location-compat
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-31 06:11:01 +01:00
Martin Vogel e546991175 Merge origin/main into feat/graph-gate-contract
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-31 06:10:40 +01:00
Martin Vogel 502d86aa0c Merge origin/main into fix/2204-opencode-extension-untouched
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-31 06:10:19 +01:00
Martin Vogel 395763cd1d Merge origin/main into fix/subagent-cli-hint
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-31 01:02:43 +01:00
Martin Vogel cf77fb84e2 Merge origin/main into fix/2722-install-managed-binary-path
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-30 22:40:59 +01:00
Martin Vogel 9cbc350720 Merge origin/main into feat/codex-skill-location-compat
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-30 22:30:12 +01:00
Martin Vogel e0546f527a Merge origin/main into feat/graph-gate-contract
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-30 22:30:04 +01:00
Martin Vogel 8f6974e025 Merge origin/main into fix/2204-opencode-extension-untouched
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-30 22:29:56 +01:00
Shane McCarron 7f2fd1081d fix(hooks): tell subagents without MCP tools how to reach the graph via the CLI
The SubagentStart hook matches every agent type, but agents defined with an
explicit tool list (e.g. tools: Read, Grep, Glob, Bash) have no MCP tools, and
SubagentStart input carries no tool list to detect that. Append one sentence to
the SubagentStart context only (indexed and unindexed variants) pointing such
agents at `codebase-memory-mcp cli <tool> --help`. Longest variant is ~1.1 KB,
well inside the 2 KB context buffer.

Closes #2837

Signed-off-by: Shane McCarron <shane.mccarron@corvexconnect.com>
2026-10-29 10:48:36 -05:00
Divakant Pandey b94a7d7a32 fix(cli): recognize symlinked agent config directories during detection (#2671)
Agent detection used POSIX lstat in dir_exists and rejected symlinks
in cbm_agent_registry_path_exists, causing dotfiles setups with
symlinked configuration directories (e.g. ~/Library/Application Support/Zed
or ~/.cursor) to be reported as undetected and skipped during install.
Use stat so valid directory symlinks are followed and detected while
preserving dangling symlink rejection.

Signed-off-by: Divakant Pandey <divakant01@gmail.com>
2026-10-29 19:39:31 +05:30
Martin Vogel 4a85a2665c Merge origin/main into fix/2722-install-managed-binary-path
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-29 01:58:26 +01:00
Martin Vogel 848975f635 Merge origin/main into feat/codex-skill-location-compat
README agent table: keep main's Claude Code row (drift note) and this
branch's Codex CLI row (skill path + PreToolUse).

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-28 18:29:56 +01:00
Martin Vogel c04d41921e Merge origin/main into feat/graph-gate-contract
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-28 18:14:47 +01:00
Martin Vogel 5af18b91ad Merge origin/main into main
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-28 18:14:39 +01:00
Martin Vogel 2a195bd202 Merge origin/main into fix/2204-opencode-extension-untouched
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-28 18:13:01 +01:00
Martin Vogel c614edcde2 Merge origin/main into fix/windows-unicode-agent-detection
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-28 18:12:44 +01:00
Divakant Pandey 55844c9da9 fix(cli): use managed binary path for agent configs when externally managed (#2722)
Signed-off-by: Divakant Pandey <divakant01@gmail.com>
2026-10-28 17:26:47 +05:30
Martin Vogel 0373c4a577 Merge origin/main into the agentty client branch
Bring the branch up to date with main (83109dde) so CI checks the
agentty integration against the current tree. No conflicts.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-28 00:00:10 +01:00
Martin Vogel 994432f068 Merge origin/main into feat/codex-skill-location-compat
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-27 20:05:45 +01:00
Martin Vogel 48762667b9 Merge origin/main into fix/2204-opencode-extension-untouched
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-27 19:17:31 +01:00
Martin Vogel 1fb8125861 Merge origin/main into fix/windows-unicode-agent-detection
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-27 19:16:50 +01:00
Martin Vogel f4ad327add Merge origin/main into feat/graph-gate-contract
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-27 19:16:42 +01:00
Martin Vogel 402617555c feat(cli): note when a Claude Code session keeps searching without the graph
The search hook gives each Grep, Glob or Bash search the matching graph
symbols, but a session can keep searching text for questions the graph answers
in one call (#509). Once a session has run three searches with no
codebase-memory-mcp tool call, the next augmentation now adds one factual line
saying so. The next note comes after six searches, then twelve, and any graph
tool call resets the count.

- State: a per-session counter in the process that runs hook requests (the
  daemon), keyed by the payload's session_id, in a bounded 64-slot table that
  evicts the least recently used session, behind a spin lock. Only searches
  that reach the graph lookup count. A search without an augmentation still
  counts, and the note waits for the next augmentation.
- Reset: Claude's managed PostToolUse entry now matches
  "Read|mcp__.*codebase-memory-mcp__.*", covering plain and plugin server
  names. The previous Read-only entry, as installs up to v0.12 wrote it, is
  recognized as owned, so install replaces it in place and uninstall removes
  either.
- Scope: Claude Code only. Codex sends the same event payload with a turn_id
  but has no reset hook, so its sessions are not tracked, and payloads without
  a session_id are not tracked either.
- Cost: a graph tool call now runs one hook round-trip to the daemon for the
  reset, about 130 ms on a local build.

Refs #509

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-27 19:04:47 +01:00
Martin Vogel 8fe97d79af Merge origin/main into fix/2204-opencode-extension-untouched
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-26 02:23:15 +01:00
Martin Vogel 158a0c9da2 test(cli): assert a real install leaves a user-owned module untouched
The byte check in cli_extension_leaves_user_owned_module_untouched_issue2204
ran only after a dry run and the plan receipt, and neither of them writes,
so it could not catch the #2204 append. The test now also runs a real
install over the user-owned module, then checks that the file is
byte-identical and that the run reports it as left untouched. Each phase's
stdout checks are bounded to that phase's slice of the capture, so no phase
can pass on another's line.

With the early return that ends the user-owned branch of
install_generated_client_extension() dropped, the test now fails; before
this change it still passed.

Refs #2204

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-26 02:22:58 +01:00
Martin Vogel 762a6e47d8 Merge origin/main into feat/codex-skill-location-compat
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-26 02:20:26 +01:00
Martin Vogel aaee4848c1 Merge branch 'main' into feat/graph-gate-contract
Brings the opt-in index exit contract up to date with main 0433142a.
The merge is clean; no file this branch changes needed a resolution.

The previous base (fceb25d8) predates the shared CI baseline (72c36044),
whose language-count contract repair is why every test leg failed at
Step 0w on the last run. That failure was in the base, not in this
branch.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-10-26 01:39:28 +01:00