ashlr

Architecture

System shape, data flows, and conventions for contributors.

ashlr-plugin is a Claude Code plugin that wraps the native file, search, and edit tools with lower-token alternatives and adds a lightweight observability layer over tool usage and cost.

Two value propositions

Token efficiency. ashlr__read, ashlr__grep, and ashlr__edit replace the built-in Read, Grep, and Edit tools. Large file reads are snip-compacted or LLM-summarized; grep calls route through a per-project genome index (RAG) when one exists, cutting tokens by ~84% on warm queries; edits send only diffs, not full file contents.

Observability. Every tool call is accounted in ~/.ashlr/stats.json (per-session + lifetime counters) and appended to ~/.ashlr/session-log.jsonl. The status line in Claude Code's UI surfaces savings continuously. The genome scribe loop extracts architectural knowledge from tool results into .ashlrcode/genome/, which feeds back into future grep routing.

MCP server map

The canonical wiring entry point is .claude-plugin/plugin.json. Every MCP server is registered there and launched via scripts/mcp-entrypoint.sh, which handles bun install on first run and forwards CLAUDE_SESSION_ID.

ServerFileTools
ashlr-efficiencyservers/efficiency-server.tsashlr__read, ashlr__grep, ashlr__edit, ashlr__savings
ashlr-bashservers/bash-server.tsashlr__bash, ashlr__bash_start/stop/tail/list
ashlr-diffservers/diff-server.tsashlr__diff
ashlr-diff-semanticservers/diff-semantic-server.tsashlr__diff_semantic
ashlr-sqlservers/sql-server.tsashlr__sql
ashlr-treeservers/tree-server.tsashlr__tree
ashlr-httpservers/http-server.tsashlr__http
ashlr-logsservers/logs-server.tsashlr__logs
ashlr-genomeservers/genome-server.tsashlr__genome_propose/consolidate/status
ashlr-orientservers/orient-server.tsashlr__orient
ashlr-githubservers/github-server.tsashlr__pr, ashlr__issue
ashlr-globservers/glob-server.tsashlr__glob
ashlr-webfetchservers/webfetch-server.tsashlr__webfetch
ashlr-multi-editservers/multi-edit-server.tsashlr__multi_edit
ashlr-askservers/ask-server.tsashlr__ask

Key shared modules

FileRole
servers/_stats.tsShared read/write for ~/.ashlr/stats.json
servers/_events.tsShared append for ~/.ashlr/session-log.jsonl
servers/_summarize.tsLLM summarizer, confidence badge, snip-compact
servers/_genome-cache.tsIn-process genome retriever cache
servers/_genome-live.tsGenome refresh after edits
servers/_http-helpers.tsHTML extraction, JSON elision, private-host check

Adding a new server

  1. Create servers/<name>-server.ts following the existing pattern (JSDoc header, Server + StdioServerTransport, ListToolsRequestSchema + CallToolRequestSchema handlers).
  2. Add the server to .claude-plugin/plugin.json under mcpServers.
  3. Call recordSaving from servers/_stats.ts in the tool handler.
  4. Call logEvent from servers/_events.ts for session log entries.
  5. Add a test in __tests__/.

See also

Full architecture doc: docs/architecture.md in the repo root.

On this page