
Pharos
Context-engineering engine that makes AI coding assistants work at peak efficiency inside any repository — every language, every build system, every size — with a measured savings report for tokens, tool calls and wall-clock time
- العميل / المالك
- Baalbek.dev – AI Engineering Division
- الجدول الزمني
- 2026 – Present
- دورنا
- Founder / AI Systems Engineer
نظرة عامة على المشروع
Pharos is named after the great lighthouse of antiquity: it guides an AI coding assistant to exactly the context it needs. Most of the cost and error in agentic coding comes from context — too much of it, the wrong parts of it, or none of the project's history — and most of the wall-clock time goes into exploratory tool calls: reading files to find the one that matters, grepping for a symbol, re-reading what was read three turns ago. Pharos sits between the developer's repository and the assistant, as a plugin and an MCP server. Its Rust indexer builds a symbol graph for any repository — 40+ languages through tree-sitter, precise resolution through language servers where they exist, heuristic indexing where they do not — and understands the build system, so a monorepo with Rust services, a TypeScript front end, Python notebooks and Bazel rules is one graph, not four guesses. A context-optimisation engine ranks what is relevant to the task and packs it into a fixed token budget with a justification per item; a query router answers structural questions ('who calls this', 'where is this configured', 'what changed since the last green build') in one tool call instead of twenty; memory keeps decisions across sessions with commit citations; hooks make every action deterministic; and the evaluation harness replays real tasks to report, per change and per session, how many tokens, tool calls and minutes were saved. The result is an assistant that reads less, remembers more, acts deterministically and reports its own efficiency — on every repository a team owns.
بيان المشكلة
Agentic coding assistants waste tokens re-reading files, lose project decisions between sessions and call tools without guardrails. On large or polyglot repositories the waste compounds: the assistant spends most of its turns on exploratory reads and searches, so cost and latency scale with the size of the repository rather than the size of the task. Teams pay for that in cost, latency and regressions, and they have no way to tell whether a prompt, skill or ranking change made the assistant better or worse — or whether the assistant works at all on the languages and build systems they actually use.
الحل
One installable plugin that packages slash commands, sub-agents, skills, hooks and an MCP server. A Rust indexer builds a symbol graph for any repository (tree-sitter for 40+ languages, LSP-backed resolution for precise references, a heuristic index for everything else) and reads the build system (Cargo, npm/pnpm workspaces, Maven/Gradle, Go modules, CMake, Bazel, Python projects) so targets, dependencies and generated code are understood; the context-optimisation engine selects and compacts context to a fixed token budget as a knapsack problem over relevance and cost, with AST-aware compaction, signature-only views, deduplication across turns and hierarchical summaries; the tool-efficiency layer routes structural questions through one 'pharos.query' tool, batches reads, prefetches the files the task will need and caches results by content hash; a memory store persists ADRs, conventions and open questions with citations to commits; hooks run formatters, linters and tests before and after tool use and steer raw greps toward the graph; and an evaluation harness replays real tasks across six languages to score quality, cost, tool calls and latency for every change — and publishes the numbers.
الميزات الرئيسية
- Universal repository support: any language (40+ grammars, LSP resolution, heuristic fallback), any build system, any size — polyglot monorepos become one graph with cross-language edges
- Budget-aware context: relevant symbols ranked by task similarity, graph distance, diff and recency, packed to a fixed token budget as a knapsack over relevance and cost, with a justification per item
- AST-aware compaction: signature-only views, body elision and docstring retention keep the map of the system inside the budget instead of dropping it
- Never read twice: deduplication across turns and a working-set cache shared by sub-agents
- pharos.query: structural questions — callers, references, implementors, configuration, tests-for, changed-since — answered in one tool call instead of a chain of reads and greps
- Batched reads, predicted-file prefetch and content-hash caching cut tool calls and wall-clock time; a read-budget guard steers raw searches toward the graph
- /pharos:context preview: see what will be sent and what it costs before it is sent; /pharos:impact: what the session saved and why
- Persistent project memory: decisions, conventions and open questions survive across sessions and cite their source commit; stale entries are flagged
- Skill routing: each task is matched to the right skill bundle and tool set without an LLM call
- Deterministic guardrails: hooks run formatters, lint, type-check and tests before and after tool calls; destructive commands blocked
- Diff-aware context: changed files and their dependents are always in scope
- Local-first indexing: code and embeddings never leave the machine; only the compacted context reaches the model
- Eval harness: replays recorded tasks across six languages to score quality, tokens, tool calls and latency for every prompt, skill or ranking change; results published on a cross-language leaderboard
- Host adapters: plugins for AI coding assistants (Claude Code today), MCP for desktop and IDE clients (VS Code, JetBrains and others), a library for agent SDKs, and a standalone CLI that emits context bundles for any model API
- Pro: cross-repository graphs, encrypted memory sync across machines (self-hosted or hosted), ranking model updates, priority grammar and build-system support
- Team / Enterprise: shared memory with review, organisation policies, audit trail, dashboards, SSO and on-prem deployment
- Compatibility contract: nightly tests against the latest supported assistants and MCP SDK builds; adapters are versioned and independently releasable
الركائز والمسارات
Universal repository model
One graph for any language, build system and size: tree-sitter, LSP and heuristic tiers, build-system readers, cross-language edges, incremental indexing.
Context-optimisation engine
Knapsack packing over relevance and cost, AST-aware compaction, deduplication across turns, hierarchical summaries with commit citations.
Tool-use efficiency
pharos.query router, batched reads, predicted prefetch, content-hash cache and a read-budget guard — fewer calls, less waiting.
Memory
Decisions, conventions and open questions with commit citations; re-validated against the tree before injection.
Guardrails and skills
Deterministic hooks and rules-first skill routing; sub-agents for review, tests, migrations and navigation.
Evaluation harness and impact report
Record, replay and score real tasks across six languages; the public proof of savings in tokens, tool calls and minutes.
Host adapters and longevity
MCP as the stable substrate; thin, versioned adapters per host; standalone CLI fallback; nightly compatibility tests.
Editions
Open core (Apache-2.0) for individuals; Pro for cross-repo, sync and priority ecosystems; Team and Enterprise editions for organisations.
الميزة التنافسية
- Works on any repository — 40+ languages, every mainstream build system, polyglot monorepos, millions of lines — with the same graph API and the same guarantees
- A real symbol graph and deterministic packing instead of retrieval heuristics — the same task gets the same context, and each item carries its justification
- Fewer tool calls, not just fewer tokens: one structural query replaces a chain of reads and greps, and the session reports what it saved
- Measured: every change ships with a replayed-task report across six languages, and users can run the same harness on their own repositories
- Works with any MCP-capable assistant through thin adapters, and degrades gracefully to a standalone CLI — no single host can strand it
- Local-first by construction, which is the only privacy story enterprises accept
النتائج المستهدفة
- Target: 40–60 % fewer input tokens per task at equal or better task success rate on a published 20-task suite spanning six languages (TypeScript, Python, Rust, Go, Java, C++) and three repository sizes; 55 % or more on repositories above 500k lines
- Target: 50 % fewer tool calls and 30 % less wall-clock time per task through pharos.query, batched reads, prefetch and caching
- Target: full index of a 1M-line polyglot repository in under 60 seconds on a laptop; incremental update after a commit in under 2 seconds
- Target: every file in a repository understood at one of three tiers (grammar, language server, heuristic) — no language excluded
- Target: zero loss of tracked decisions between sessions; stale memory flagged before injection
- Target: every skill, prompt or ranking change scored against the replayed suite before release, with the leaderboard updated publicly
- Target: identical behaviour across every supported assistant, MCP clients and the standalone CLI on the compatibility suite
النتائج المتوقعة
ما الذي يحققه البرنامج عند بلوغه النضج المستهدف.
- 40–60 % lower token cost and 30 % faster tasks for individual developers and teams, on every repository they own
- A measurable, repeatable way to evaluate prompt and skill changes — and to prove savings to a finance team
- A universal indexing, query and memory layer that the studio's other developer tools build on
الجدوى التقنية
Every component exists in mature form — tree-sitter, language servers, SQLite with vector search, local ONNX embeddings and the plugin and MCP surfaces of today's coding assistants. The engineering risk is in ranking quality, budget heuristics and build-system coverage, all of which are measurable with the task-replay harness from day one. Platform risk is contained by building on MCP and isolating each host in a versioned adapter with nightly compatibility tests.
الدروس المستفادة
- Context is a scheduling problem, not a prompt-writing problem.
- Most agent latency is exploration; a graph query is worth twenty reads.
- Deterministic tooling is what makes AI output reviewable.
- Local-first indexing is the only credible privacy story for enterprise teams.
فريق المشروع

مهندس أنظمة الذكاء الاصطناعي
معمارية الإضافة، ومفهرس Rust، ونموذج المستودع الموحّد، ومحسِّن السياق وموجّه الاستعلامات، وأداة التقييم.
عرض الملفهل لديك نظام مشابه في ذهنك؟
تحدث معنا عن شراكات بحثية أو تجارب مؤسسية أو البناء على إحدى منصاتنا.

