{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreifgbmxaflicynjqlkctnndauf5qbqohthyusl4ulhtmessrhmzgtq",
    "uri": "at://did:plc:25rdn5elo5izoxrmtis34zuk/app.bsky.feed.post/3mpkmttrifk42"
  },
  "coverImage": {
    "$type": "blob",
    "ref": {
      "$link": "bafkreiepw4tjsvlbmkshsgko367q4o3zqjiuzprmwn642vzku6nbylhyqm"
    },
    "mimeType": "image/webp",
    "size": 68360
  },
  "path": "/rohith_matam_be6aea5caf13/i-built-a-context-os-that-stops-ai-agents-from-drowning-in-your-codebase-636",
  "publishedAt": "2026-07-01T03:44:37.000Z",
  "site": "https://dev.to",
  "tags": [
    "ai",
    "python",
    "opensource",
    "productivity",
    "https://github.com/Rohithmatham12/ContextOS",
    "https://Rohithmatham12.github.io/ContextOS/"
  ],
  "textContent": "##  The problem every AI coding session hits\n\nYou open Claude or Copilot, paste in your task, and immediately hit the wall: the codebase is too big. You either:\n\n  * Dump everything and burn 80% of your context window on irrelevant files\n  * Hand-pick files and miss the one import that breaks everything\n  * Pay for a bigger context window and repeat the problem at scale\n\n\n\nI got tired of this and built **ContextOS** — a local CLI that acts as an intelligent context layer between your repo and your AI agent.\n\n##  What it does\n\n\n    pip install rm-contextos\n    cd your-project\n    contextos scan\n    contextos pack --task \"add rate limiting to the auth endpoint\" --budget 8000\n\n\nOutput: a Markdown (or JSON) context pack with only the files that matter for that task — ranked by keyword match, import graph centrality, AST symbol overlap, and git churn. Secrets redacted automatically.\n\nToken savings report on every pack:\n\n\n\n    Packed 12 files · ~6,840 tokens · saved ~47,200 tokens (87%) vs full repo\n\n\n##  How ranking works\n\nFive signals combine into a score per file:\n\nSignal | What it catches\n---|---\nKeyword match | Files whose content/name overlap with your task\nImport graph centrality | Files that everything else imports (critical shared modules)\nAST symbol overlap | Function/class names, not just grep strings\nGit churn score | Recently modified files are probably active code\nSecret penalty | Credential files silently excluded\n\nNo LLM calls. No cloud. Fully offline.\n\n##  MCP server (for Claude Desktop / Claude Code)\n\n\n    pip install \"rm-contextos[mcp]\"\n    contextos serve --stdio\n\n\nRegister in `claude_desktop_config.json` and your AI agent can call `pack_context`, `scan_repo`, `list_files`, `get_file`, `churn_report` directly as tools — no CLI needed.\n\n##  What's shipped\n\n  * 980 tests, 96% coverage\n  * Apache-2.0, no telemetry, no accounts\n  * Python 3.11–3.13, Linux + macOS\n  * Export formats: Claude, Codex, Cursor, Aider, JSON\n  * Incremental scan cache — re-scans only changed files\n\n\n\n\n    pip install rm-contextos\n    pip install \"rm-contextos[mcp]\"   # + MCP server\n    pip install \"rm-contextos[all]\"   # everything\n\n\nGitHub: https://github.com/Rohithmatham12/ContextOS\nDocs: https://Rohithmatham12.github.io/ContextOS/\n\n**Would love feedback** — especially on the ranking signals and MCP integration. What signals are you missing?",
  "title": "I built a \"context OS\" that stops AI agents from drowning in your codebase"
}