Skip to content

feat: agent-native bridge — drive CrickNote from Claude Code / Codex via CLI#3

Merged
hele211 merged 26 commits into
mainfrom
feat/agent-native-bridge
Jun 12, 2026
Merged

feat: agent-native bridge — drive CrickNote from Claude Code / Codex via CLI#3
hele211 merged 26 commits into
mainfrom
feat/agent-native-bridge

Conversation

@hele211

@hele211 hele211 commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Summary

Adds an agent-native bridge so Claude Code / Codex can drive CrickNote's existing 35 lab tools directly from the shell, with the Obsidian vault as the source of truth. No MCP server, no chat runtime — a thin CLI over the existing ToolRegistry.

New CLI surface

  • cricknote tool <name> '<json>' — execute any registered tool; write-tools' pending_edit results are applied through a shared path. --no-apply for dry-run, --session for audit attribution.
  • cricknote tools — full tool catalog (name, description, JSON params).
  • cricknote reindex — rewritten as a standalone, embedding-free full index (BM25 + metadata).

Core mechanismapplyPendingEdit reuses SafeWriter for atomic write + audit log, then layers reservation finalize, folder changelog, and incremental BM25 indexing. Symlink-safe vault-boundary check via resolveVaultPath. buildToolRegistry is now shared by the Obsidian runtime and the CLI (single tool surface).

Supporting changes

  • vault_search no longer loads the embedding model at query time (structured filters + BM25 only) — fast in a one-shot CLI process.
  • task_list/task_complete scan a configurable 90-day window (was 14); task_add deadlines normalized to ISO via chrono-node.
  • Removed unused node-cron.

Agent assets (Phase 2)

  • Vault-level CLAUDE.md + AGENTS.md (conventions, tool-first write rule, serial scheme).
  • Five workflow skills: record-experiment, reading-intake, kb-update, daily-review, reminders (one-way Apple Reminders push).
  • cricknote setup copies these into the vault's .claude/skills/ and .agents/skills/ (merge-safe — preserves a user's own skills).

Design & plan

  • Spec: docs/superpowers/specs/2026-06-10-agent-native-bridge-design.md
  • Plan: docs/superpowers/plans/2026-06-10-agent-native-bridge.md

Built subagent-driven, one task per commit, each with spec + code-quality review. Phase 3 (pruning the retired runtime/embedder/websocket) is intentionally deferred until the bridge has proven itself in real use.

Test Plan

  • npx tsc --noEmit clean
  • Full suite green: 694 passed / 9 skipped (70 files)
  • Integration test drives the full cycle through the dispatcher: create_projectregister_project_counterscreate_experimentvault_appendvault_search (tests/integration/cli-bridge.test.ts)
  • Smoke-tested against the live vault: cricknote tools, cricknote tool vault_search, cricknote tool task_add --no-apply (writes nothing)
  • Manual end-to-end: drive a real lab session from the vault directory with both Claude Code and Codex (Task 16 — reviewer/author follow-up)

🤖 Generated with Claude Code

hele211 and others added 26 commits June 10, 2026 08:47
…e chat runtime)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ep-list, semantic rank in phase 1, reindex rewrite, reservation lifecycle)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…mpt ordering

- Use resolveVaultPath for symlink-safe path resolution in worker, vault,
  context-assembler, and related tools (stat before read; reject symlinks)
- Register ingestion 'error' listener before start() to avoid unhandled events
- Reorder system-prompt layers so Zotero workflow takes priority over the
  vault-native reading workflow when Zotero is enabled
- Add path-hardening and context-assembler tests; cricknote-workflows integration test

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…free module

Moves the regex helper out of worker.ts (which transitively loads chokidar
and the embedding model) into a standalone ignore.ts with no heavy deps, so
it can be imported by the CLI dispatcher and future indexer without side-effects.
worker.ts re-exports the name for full back-compat.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…walker

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…versal catch

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Pull the nine tool-factory calls out of the AgentRuntime constructor
into a standalone buildToolRegistry() factory so the forthcoming CLI
dispatcher can obtain an identical tool surface without constructing an
LLM provider or requiring an API key.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… as-never cast

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ervation path

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…t reservation rollback

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…light

runTool() wraps buildToolRegistry, handles unknown-tool/bad-JSON errors,
dispatches single pending_edit and pending_edits batch shapes through
applyPendingEdit, and enforces vault-boundary preflight before any write.
listToolCatalog() exposes the full tool surface for CLI enumeration.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…reflight

Guard args parsing against null/array/scalar JSON values; add three regression
tests. Add vault_write apply integration test confirming the in-vault preflight
happy-path; document in a comment that the out-of-vault branch is defense-in-depth
(all existing tools pre-resolve paths via resolveVaultPath before emitting
pending_edit, so the branch is unreachable through any current real tool).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…search cycle

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Replaces the old clear-and-restart stub with reindexVault(), which walks
the vault, calls indexFileSync for BM25+metadata on every .md file, and
removes stale DB rows via deleteStaleNotes — no embeddings, no service.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Removes the embedText/semanticRank/assembleContext block from vault_search.
Structured filters + BM25 fully cover lab use cases without model-load latency.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…stale description

Remove unused vaultPath from createSearchTools signature and all call
sites (build-registry.ts, 3 unit tests, 2 e2e tests). Drop context:''
from the serial fast-path return to match the main path shape. Update
vault_search description to reflect BM25-only matching (semantic
ranking was removed in task 9).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ormalized deadlines

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…, cover NL deadline

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds installAgentAssets() which copies skills/ into .claude/skills/ and
.agents/skills/, and writes CLAUDE.md/AGENTS.md to the vault root on
every setup run; idempotent re-runs refresh stale copies.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@hele211 hele211 merged commit 0f9d075 into main Jun 12, 2026
@hele211 hele211 deleted the feat/agent-native-bridge branch June 12, 2026 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant