{"id":47627018,"url":"https://github.com/chrisfentiman/claude-context-cli","last_synced_at":"2026-04-01T22:52:33.898Z","repository":{"id":346077060,"uuid":"1188436096","full_name":"chrisfentiman/claude-context-cli","owner":"chrisfentiman","description":"Auto-indexing CLI for claude-context-mcp (npm: claude-context-cli)","archived":false,"fork":false,"pushed_at":"2026-03-22T17:51:01.000Z","size":131,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-22T19:35:50.493Z","etag":null,"topics":["auto-indexing","claude-code","claude-code-plugin","cli","code-search","mcp","milvus","semantic-search"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/claude-context-cli","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chrisfentiman.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-22T04:19:12.000Z","updated_at":"2026-03-22T17:51:05.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/chrisfentiman/claude-context-cli","commit_stats":null,"previous_names":["chrisfentiman/claude-context-cli"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/chrisfentiman/claude-context-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisfentiman%2Fclaude-context-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisfentiman%2Fclaude-context-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisfentiman%2Fclaude-context-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisfentiman%2Fclaude-context-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrisfentiman","download_url":"https://codeload.github.com/chrisfentiman/claude-context-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisfentiman%2Fclaude-context-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31292717,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T21:15:39.731Z","status":"ssl_error","status_checked_at":"2026-04-01T21:15:34.046Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["auto-indexing","claude-code","claude-code-plugin","cli","code-search","mcp","milvus","semantic-search"],"created_at":"2026-04-01T22:52:29.108Z","updated_at":"2026-04-01T22:52:33.883Z","avatar_url":"https://github.com/chrisfentiman.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# claude-context-cli (`ctx`)\n\n[![npm](https://img.shields.io/npm/v/claude-context-cli?style=flat-square)](https://www.npmjs.com/package/claude-context-cli)\n[![License](https://img.shields.io/github/license/chrisfentiman/claude-context-cli?style=flat-square)](LICENSE)\n[![CI](https://img.shields.io/github/actions/workflow/status/chrisfentiman/claude-context-cli/ci.yml?style=flat-square)](https://github.com/chrisfentiman/claude-context-cli/actions)\n\n\u003e Auto-indexing CLI and Claude Code plugin for [@zilliz/claude-context-mcp](https://github.com/zilliztech/claude-context). Keeps your codebase index fresh automatically.\n\n## Table of Contents\n\n- [Problem](#problem)\n- [Features](#features)\n- [Install](#install)\n- [Usage](#usage)\n- [Configuration](#configuration)\n- [Plugin Hooks](#plugin-hooks)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Problem\n\n`claude-context-mcp` provides semantic code search via Milvus, but it only indexes when explicitly told to. After git pulls, code edits, or branch switches, the index goes stale and search results become incomplete.\n\n## Features\n\n- Automatic re-indexing on session start, after git operations, and on session end\n- Staleness detection via git commit timestamps and dirty file tracking\n- Incremental indexing (Merkle tree based, only changed files re-embedded)\n- Config resolution matching claude-context-mcp (walks `.mcp.json` \u003e `~/.claude.json` \u003e `~/.context/.env`)\n- Standalone CLI for manual indexing and search\n- Claude Code plugin with async hooks\n- Distributed via npm with native module support\n\n## Install\n\n### npm (recommended)\n\n```bash\nnpm install -g claude-context-cli\n```\n\nThis installs both `claude-context-cli` and the shorter `ctx` alias.\n\n### Claude Code plugin\n\n```bash\n/plugin marketplace add chrisfentiman/claudesplace\n/plugin install claude-context-cli\n```\n\n### From source\n\n```bash\ngit clone https://github.com/chrisfentiman/claude-context-cli.git\ncd claude-context-cli\nnpm install\nnpm run build\n```\n\n## Usage\n\n```bash\n# Index a codebase (incremental)\nctx index [path]\n\n# Index only if stale (new commits or dirty files changed)\nctx index --if-stale [path]\n\n# Force full re-index\nctx index --force [path]\n\n# Check index status\nctx status [path]\n\n# Semantic search\nctx search \"authentication middleware\" [path]\nctx search \"database connection\" -n 5 [path]\n\n# Clear index\nctx clear [path]\n```\n\nIf running from source, use `npx ts-node cli.ts` or `node dist/cli.js` after `npm run build`.\n\n## Configuration\n\nConfiguration is resolved by walking the same sources as claude-context-mcp, in priority order:\n\n1. `process.env` (highest)\n2. `.mcp.json` (project-level, `claude-context` server env)\n3. `.claude/.mcp.json`\n4. `~/.claude.json` (user-level MCP config)\n5. `~/.context/.env` (claude-context global config)\n6. Defaults (lowest)\n\n### Environment variables\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `EMBEDDING_PROVIDER` | `Ollama` | `Ollama`, `OpenAI`, `Gemini`, `VoyageAI` |\n| `EMBEDDING_MODEL` | Provider-specific | Model name |\n| `OLLAMA_HOST` | `http://127.0.0.1:11434` | Ollama server URL |\n| `OLLAMA_MODEL` | `nomic-embed-text` | Ollama model (overrides `EMBEDDING_MODEL`) |\n| `MILVUS_ADDRESS` | `127.0.0.1:19530` | Milvus server address |\n| `MILVUS_TOKEN` | -- | Milvus/Zilliz Cloud auth token |\n| `OPENAI_API_KEY` | -- | Required for OpenAI provider |\n| `OPENAI_BASE_URL` | `https://api.openai.com/v1` | Custom OpenAI-compatible endpoint |\n| `GEMINI_API_KEY` | -- | Required for Gemini provider |\n| `GEMINI_BASE_URL` | -- | Custom Gemini endpoint |\n| `VOYAGEAI_API_KEY` | -- | Required for VoyageAI provider |\n\n### Staleness detection\n\nThe CLI tracks index state in `.claude/context/last-index.json`:\n\n1. Records the latest git commit timestamp and dirty file count after each index\n2. On `--if-stale`, compares current git state against saved state\n3. Re-indexes only if new commits exist or dirty file count changed\n4. Merkle tree in `@zilliz/claude-context-core` handles file-level diffing\n\n## Plugin Hooks\n\nWhen installed as a Claude Code plugin, three hooks fire automatically:\n\n| Hook | Event | Behavior |\n|------|-------|----------|\n| `SessionStart` | Session opens | `index --if-stale` (async) |\n| `PostToolUse` | After Bash commands | Re-index after `git pull/merge/checkout/rebase` (async) |\n| `SessionEnd` | Session closes | `index --if-stale` (async) |\n\nAll hooks are async and non-blocking.\n\n## Prerequisites\n\n- A running [Milvus](https://milvus.io) instance or [Zilliz Cloud](https://cloud.zilliz.com) account\n- An embedding provider: [Ollama](https://ollama.ai) (default), OpenAI, Gemini, or VoyageAI\n- `claude-context-mcp` configured as an MCP server\n\n## Contributing\n\n1. Fork the repo\n2. Create your feature branch (`git checkout -b feat/something`)\n3. Commit changes (`git commit -m 'feat: add something'`)\n4. Push to branch (`git push origin feat/something`)\n5. Open a PR\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisfentiman%2Fclaude-context-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrisfentiman%2Fclaude-context-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisfentiman%2Fclaude-context-cli/lists"}