Documentation
¶
Overview ¶
Package cli implements the non-hook subcommands. One concern per file.
Index ¶
- func Card(args []string) error
- func Down(args []string) error
- func Export(args []string) error
- func Gen(args []string) error
- func Import(args []string) error
- func Index(args []string) error
- func Init(args []string) error
- func Learn(args []string) error
- func MCP(args []string) error
- func Query(args []string) error
- func Review(args []string) error
- func Serve(args []string) error
- func Stats(args []string) error
- func Statusline(args []string) error
- func Version(_ []string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Down ¶
Down records an explicit downvote — the strongest negative utility signal. The multiplier is clamped, so even a hammered card stays retrievable; `culi card rm` is the way to actually remove one.
func Export ¶
Export regenerates ~/.claude/agents and ~/.claude/skills from canonical cards. --check reports drift (hand edits, pending updates) without writing.
func Gen ¶
Gen runs learning pipeline C: git facts → CLAUDE.md marker spans + repo-scoped cards. Explicit user command, so unlike the background worker it errors loudly when no backend is available.
func Index ¶
Index syncs knowledge/ into the SQLite index, then embeds cards missing a fresh vector. A dead Ollama downgrades the second step to a notice — BM25 keeps working regardless.
func Learn ¶
Learn drains the learning inbox once. --auto is the detached mode the session-end hook spawns: all output goes to logs/learn.log, exit is always clean (a background learner must never surface errors into a terminal that isn't there).
func MCP ¶
MCP serves the stdio MCP server — spawned by Claude Code, runs until the client disconnects.
func Query ¶
Query runs the retrieval funnel from the terminal — the debug window into what a hook would inject for a given prompt.
func Review ¶
Review is the optional HITL gate over mined candidate cards: approve (confirm — starts injecting), reject (retire), or leave for later. Mining never blocks on review; confirmation also happens organically at two observations.
func Serve ¶
Serve runs the local review console (plan §5): a web UI over the knowledge store for candidate triage, KB browsing, and token-savings/job-health dashboards. It is off every hot path — a convenience surface, not part of hook or MCP serving — so it opens the store read-mostly and reuses the same mine/index/knowledge functions `culi review` does for its few writes.
The StatsFn closure hands the console the `culi stats` report without serve importing this package (which would cycle): serve re-marshals it to JSON.
func Stats ¶
Stats prints the token-accounting and learning report (plan §10). All numbers are best-effort views over disposable state: the injection log is retention-bounded (~7 days), skip counts come from the hook log, spend from the learn ledger. --json emits the same report machine-readably for external monitoring (field names are snake_case; treat the schema as evolving, not a contract).
func Statusline ¶
Statusline renders culi's segment for Claude Code's statusLine protocol: session JSON on stdin, one line on stdout. Same discipline as hooks (C1): any failure prints nothing and exits 0 — a broken statusline must never distract from a working session.
Types ¶
This section is empty.