Documentation
¶
Index ¶
- Constants
- func DetectHosts(absRoot string) []string
- func EnsureGitignore(absRoot string) (bool, error)
- func RunEnrich(ctx context.Context, args []string, log *slog.Logger, modelName string) error
- func RunFeedback(ctx context.Context, args []string, log *slog.Logger) error
- func RunHook(args []string) int
- func RunIndex(ctx context.Context, args []string, log *slog.Logger, indexPath string, ...) error
- func RunInit(ctx context.Context, args []string, log *slog.Logger, ...) error
- func RunMCP(ctx context.Context, args []string, log *slog.Logger) error
- func RunQuery(ctx context.Context, args []string, log *slog.Logger) error
- func RunWarmup(ctx context.Context, _ []string, log *slog.Logger, modelName string) error
- func RunWatch(_ context.Context, _ []string) error
- func WriteHostConfig(host, absRoot, cmdPath, dbPath string) ([]string, error)
Constants ¶
const ( HostClaudeCode = "claude-code" HostCursor = "cursor" HostCodex = "codex" HostAuto = "auto" )
Variables ¶
This section is empty.
Functions ¶
func DetectHosts ¶
DetectHosts reports which agent hosts look present for this repo/user.
func EnsureGitignore ¶
EnsureGitignore appends ".contextmaxxer/" to the repo's .gitignore when the repo is git-tracked and the entry is missing — the index db and veccache are multi-MB binary artifacts that `git add .` would otherwise commit.
func RunEnrich ¶
RunEnrich generates synthetic purpose docstrings for indexed symbols via an OpenAI-compatible LLM endpoint and stores them in <root>/.contextmaxxer/synthetic-docs.json. Run `index` afterwards (with -force to re-embed unchanged files) so the summaries reach the embeddings.
func RunFeedback ¶
RunFeedback handles `contextmaxxer feedback <verb>`. Currently the only verb is `export`, which copies the feedback log (optionally redacted) into a single file ready to hand back to the maintainer for ranker training.
func RunHook ¶
RunHook implements the "discovery gate" used as a Claude Code hook. It returns the process exit code directly: 2 blocks a tool call (PreToolUse semantics), 0 allows it. It must stay fast and dependency-free — it runs on every gated tool call (no DB, no model, no app init).
contextmaxxer hook pre-search # PreToolUse on Grep|Glob contextmaxxer hook post-find # PostToolUse on find_context (Claude Code) contextmaxxer hook search-signal # a search on Cursor/Codex: record, never block
The gate forces an agent to lead with find_context: the first Grep/Glob in a session is blocked until find_context has been called once, after which grep/glob are allowed (for literal-string / filename / refinement searches). It fails open — any misconfiguration or missing session id allows the call.
func RunInit ¶
func RunInit(ctx context.Context, args []string, log *slog.Logger, noEmbeddings, includeTests bool, modelName string) error
RunInit is the one-shot onboarding command: it indexes a repo, stages the host-agent enrich flow, and WRITES the host configs (MCP registration + adoption hook/rule) for the requested agent hosts. DECISION(2026-07): init used to only print paste-me blocks; the beta flow is now "tell your agent to install this", so the deterministic merge lives here where it is tested, instead of every host agent free-styling JSON edits. -no-write restores the print-only behavior; every writer merges and is idempotent (see hostsetup.go).
func RunWarmup ¶
RunWarmup downloads and initializes the embedding model, reranker and ONNX runtime up front, so the first real `init`/`index`/`mcp` run starts instantly instead of appearing to hang on a ~250MB download. Idempotent: a no-op once everything is cached.
func WriteHostConfig ¶
WriteHostConfig applies the writer for one host. Returns touched files.
Types ¶
This section is empty.