repogrammar_context
A read-only MCP tool that provides local-first, source-backed repository context for coding agents, returning metadata and a bounded read plan without requiring full file reads.
README
RepoGrammar
Local-first, source-backed repository context for coding agents.
Coding agents repeatedly read the same files to rediscover how a repository
implements routes, fixtures, models, and data access. RepoGrammar builds a
compact map of those implementation-pattern families before an agent reads
source broadly. It returns metadata and a hash-checked read plan when evidence
is strong, and a typed UNKNOWN instead of guessing when it is not.
This is an audited excerpt from a real 0.2.0-preview.0 CLI run against
committed Python fixtures. Paths were normalized for display; the
commands and transcript are
reproducible from this checkout.
Install
Stable channel — verify the exact version
Availability is decided by the exact 0.2.2 publication, not by the
contents of this README. Verify both registries and the complete npm channel
mapping before using the no-build path:
npm view @sioyooo/repogrammar@0.2.2 version
npm view @sioyooo/repogrammar dist-tags --json
curl -fsSI https://github.com/SioYooo/RepoGrammar/releases/download/v0.2.2/install.sh.sha256
Continue only when the exact-version and GitHub checks succeed and the dist-tag
object contains exactly "latest":"0.2.2" and
"preview":"0.2.0-preview.0". Then run the pinned stable-channel release:
npx @sioyooo/repogrammar@0.2.2 setup --project /path/to/your/repo --target auto
After all three checks succeed, unversioned npx @sioyooo/repogrammar
resolves the same 0.2.2 package through npm latest. Use the exact version
for reproducible automation. The separate @preview dist-tag remains on
0.2.0-preview.0; publishing stable must not rewrite that historical package.
If any check fails, use the contributor/dogfood path, which builds once from source. The complete publication gate is in the stable release checklist.
git clone https://github.com/SioYooo/RepoGrammar.git
cd RepoGrammar
cargo build --release
bash src/install/repogrammar-install.sh --install-cli-only --from-source --yes
repogrammar version
The installed command needs Python 3.10 or newer (python3) for the bounded
Python analyzer. It does not need Node.js, npm, Docker, a local model, an
OpenAI API key, or a cloud API.
From setup to trustworthy context
Run setup inside the repository you want to analyze. It reviews one plan, initializes and indexes the repository, wires a detected Codex or Claude Code integration when ownership is safe, starts auto-sync by default, and runs a read-only product MCP self-test:
cd /path/to/your/repo
repogrammar setup --target auto
# Ask for a source-backed family and a bounded read plan.
repogrammar find --project . --token-budget 8000 app/routes.py
# Conformance remains advisory when runtime equivalence is unproven.
repogrammar check --project . --token-budget 8000 app/routes.py
The captured demo also asks for a target that static evidence cannot resolve:
repogrammar find --project . --token-budget 8000 registered_router
It returns UNKNOWN, identifies InsufficientSupport, and recommends source
fallback. That is a successful safety decision, not a failed query. Use the
fixture-backed walkthrough to reproduce
the exact find → check → UNKNOWN path.
How it works
RepoGrammar ships a pattern-family-first CLI and one read-only MCP tool,
repogrammar_context.
- Discover candidates locally. Language adapters and bounded semantic workers extract source-backed structural facts without executing the target repository.
- Require compatible support. Tree-sitter proposes candidates; it is not treated as a semantic oracle. Family claims require compatible exact-anchor evidence.
- Return metadata first. Results include repo-relative evidence, hashes, byte and line ranges, variation/exception coverage, and a minimal read plan. Source snippets are opt-in.
- Abstain by type. Stale, ambiguous, dynamic, unsupported, or insufficient
evidence becomes
UNKNOWNorPARTIAL_CONTEXT, with a recovery action. - Stay local and fresh. The active SQLite index lives under
.repogrammar/; explicit sync and auto-sync keep repository evidence current.
The Rust implementation follows a dependency-inverted
core → ports → application → adapters → interfaces architecture. See the
architecture overview and
MCP contract.
Support and limitations
| Language | Current evidence boundary |
|---|---|
| Python — FastAPI, pytest, Pydantic, SQLAlchemy | Bounded framework-family context, not full Python semantics |
| TypeScript / JavaScript — Express, Jest/Vitest, Next.js, Fastify, Prisma, Drizzle | Conservative exact-anchor preview |
| Java/Spring, C#, C/C++ | Structural preview; no runtime/build-system equivalence claim |
| Rust | Internal self-dogfood; no general Rust semantic-analysis claim |
| Go, PHP, Ruby, Swift | File discovery only; not analyzed or supported yet |
RepoGrammar 0.2.2 is the first published stable-channel pre-1.0 release. Its
MCP API and non-Python analyzers remain experimental; this is not a 1.0
API-stability or production-readiness claim. RepoGrammar is not a sound static
analyzer and does not replace source inspection.
estimated_potential_token_savings is an estimated local read-displacement
diagnostic—not measured savings or a causal claim. Measured savings require a
controlled before/after study; the current
limitations keep that boundary explicit.
macOS and Linux are the current supported platforms. Windows is not fully supported because its local index lifecycle still needs platform proof; no Windows release support is claimed.
Codex and GPT 5.6 Usage
RepoGrammar asks whether coding agents can read less repository source without becoming more confident than the evidence permits. OpenAI Build Week is a launch milestone, not the product boundary: RepoGrammar is being built as an ongoing local developer tool for coding-agent workflows.
The implementation used a human-directed GPT-5.6 workflow:
- ChatGPT (GPT-5.6) helped turn the maintainer's product direction into plans and reviewed each completed slice.
- Codex (GPT-5.6) implemented and tested Rust modules, language adapters, CLI behavior, release tooling, and documentation against repository gates.
- The human maintainer owns architecture, scope, evidence policy, review, and every merge. Commits use only the maintainer's identity.
Repository guardrails keep that collaboration auditable: the mirrored
AGENTS.md / CLAUDE.md contract requires scoped changes, tests and docs in
the same commit, no target-repository code execution, and typed UNKNOWN
instead of unsupported claims. The reusable
demo script and
launch kit contain the Build Week submission
copy without turning the README into a competition-only landing page.
License
RepoGrammar is licensed under the MIT License.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。