Skip to main content
Glama

TIER v1.0.0 — Tiered Information for Efficient Retrieval

A 4-layer context format, codebase graph indexer, and zero-dependency MCP server that cuts AI agent token usage by 86%–97%.

Python 3.9+ Zero Dependencies MIT License Tests 88/88 MCP 2.3 Compatible

Quickstart · See it in action · Benchmarks · Architecture · Format spec


TIER keeps AI agents from loading whole repositories and documents into context. It gives every document an always-loadable L0 index, one-line L1 abstracts, L2 signatures and dependency edges, and surgical L3 source-line slices. A hybrid retriever, incremental repository map, reverse-dependency impact graph, and write-back memory keep context small and current.

The core is 100% Python standard library — no runtime dependencies, no API calls, no telemetry. Optional extras add terminal styling and the official MCP SDK adapter.

30-Second Quickstart

From a checkout:

python3 -m pip install .          # or: python3 -m pip install -e .
# isolated CLI: uv tool install .  /  pipx install .

Then run the two commands that configure and verify everything:

tier install      # interactive wizard: Claude Code, Claude Desktop, Cursor, VS Code, Windsurf
tier doctor       # environment, configs, repo.tier, lint, and sync checks

tier install writes safe .bak backups, preserves other MCP servers, and is idempotent. Use --clients, --yes, --dry-run, or --uninstall for scripts and CI. tier setup is an alias.

Related MCP server: parecode

See It in Action

$ tier from-repo . -o repo.tier
wrote repo.tier

$ tier index repo.tier | head -4
tier repository map - 24 source files; languages: javascript 1, python 23; entrypoints: ...
! Read the repo.tier module map before opening source files; fetch only the listed line ranges.
! Use tier_get with follow=true to pull a module and its direct local dependencies.
! Use tier_slice for exact L3 source slices instead of reading whole files.

$ tier find repo.tier "parse TIER document" -k 1
@src-tier-parser.py  46.75  src/tier/parser.py (python module); symbols: wrap_untrusted, parse, nodes, ...

$ tier slice repo.tier src/tier/parser.py parse
@src-tier-parser.py#parse [L43-L111]
    def parse(text: str) -> Doc:
        doc = Doc()
        ...

$ tier impact repo.tier src/tier/parser.py
Impact target: @src-tier-parser.py
Direct dependents: @src-tier-__init__.py, @src-tier-cli.py, @src-tier-converter.py, ...
Dependencies: @src-tier-models.py

Measured on this repository: 49,725 raw src/tier tokens → 695-token L0 → 1,460-token L0 + one-hop. The complete five-step workflow costs 4,441 tokens (−91.1%) while retrieving 3/3 exact slices and 10/10 dependents.

Core Capabilities

Capability

What it does

4-Layer Progressive Disclosure

L0 index, L1 abstracts, L2 signatures and > edges, L3 exact source lines. Load only the layer you need.

Polyglot Repo Maps

Python AST plus JS/TS/Go/Rust symbol extractors, exact line ranges, fingerprints, and local import edges. Verified 203/203 symbols and 75 edges on this repo.

Hybrid Search

Identifier splitting, BM25-style field weights, synonyms, trigrams, table boosts, and navigation priors. 15/15 hit@1 on a 197-section blind corpus.

Collision-Free Untrusted Guards

wrap_untrusted picks a guard that cannot be forged in the payload; <<<source #g1 ... >>>g1 keeps external text opaque.

Stateful Write-Back Memory

tier_remember persists verified rules, decisions, keys, and references with atomic, lint-checked writes.

Stream & Hook Compression

tier pipe and tier hook collapse noisy logs, JSON, and tool output; malformed and binary input are handled safely.

Safe Interactive Installer

tier install detects five host families, backs up configs, previews diffs, and uninstalls only TIER entries. tier doctor verifies the result.

Verified Benchmarks

All numbers below are from benchmarks/BENCH.txt, produced by benchmarks/bench.py with the o200k_base tokenizer. TIER measures tokens and retrieval identifiers, not LLM answer accuracy.

Track

What it measures

Verified result

A

60 uniform records × 6 fields

TIER table 1,331 tokens, −61% vs pretty JSON; same as CSV

B

Nested config, 4 levels

TIER key/value 143 tokens, −39% vs pretty JSON, −13% vs YAML

C

Payments runbook retrieval

8/8 hit@1, 8/8 hit@2; 352-token L0; mean top-1 fetch 124 tokens

D

5 real GitHub Markdown docs

+2% to +15% vs Markdown; 99.2–100% word recall; 0 lint errors

E

Paraphrase retrieval

10/10 hit@1 (v0.2 exact-prefix: 7/10)

F

Repository map (src/tier)

49,725 raw → 7,200 full map (−86%); 695 L0; 1,460 L0 + 1-hop (−97%); 203/203 symbols, 75 edges, 0 lint errors

G

End-to-end 4-layer workflow

4,441 tokens (−91.1%); 3/3 exact slices; 10/10 expected dependents

H

Polyglot fixture (Python/TS/Go/Rust)

116/116 symbols, 116/116 ranges, 10/10 edges; surgical context 2,854 vs 8,249 (−65%)

I

197-section blind retrieval

15/15 hit@1, 15/15 hit@2; mean top-1 134 tokens; 6,039 vs 52,275 (−88%)

The checked-in self-index repo.tier maps 24 source files in 11,034 tokens with an 893-token L0 (8%). Reproduce the full suite:

./benchmarks/fetch_corpus.sh     # optional: Tracks D and I corpus
python3 benchmarks/bench.py      # writes benchmarks/BENCH.txt

tier install / tier setup detects and configures:

Client

Config paths

Claude Code (project)

.mcp.json, .claude/settings.json (hook), CLAUDE.md, AGENTS.md

Claude Code (user)

~/.claude.json, ~/.claude/settings.json, ~/.claude/CLAUDE.md

Claude Desktop

macOS ~/Library/Application Support/Claude/claude_desktop_config.json; Linux ~/.config/Claude/claude_desktop_config.json; Windows %APPDATA%\Claude\claude_desktop_config.json

Cursor

project .cursor/mcp.json or global ~/.cursor/mcp.json

VS Code (Copilot MCP)

project .vscode/mcp.json (servers key, stdio entry)

Windsurf

~/.codeium/windsurf/mcp_config.json

tier install                                      # interactive
tier install --clients claude-code,cursor --yes   # scripted
tier install --clients all --dry-run              # preview diffs only
tier install --uninstall --clients all            # remove TIER entries only
tier install --no-repo --no-hook --instructions none

Every existing JSON config is backed up to <file>.bak before an atomic merge. Existing servers, hooks, and keys are preserved. The installer prefers an absolute tier-mcp executable, falling back to the absolute current interpreter with -m tier.mcp, so GUI hosts do not depend on shell PATH.

The default pip install tier runtime is stdlib-only, with dependencies = [].

pip install "tier[ui]"    # rich terminal rendering for installer/doctor
pip install "tier[mcp]"   # official mcp v2 SDK adapter
pip install "tier[all]"   # both
  • [ui] adds rich styling. Without it, the installer and doctor use ANSI colors and box drawing with a clean non-TTY fallback.

  • [mcp] adds the official mcp>=2.0 SDK and the tier-mcp-sdk command / python -m tier.mcp.sdk_server module. It wraps all 11 tools with MCP v2 MCPServer (v1 FastMCP fallback), supports mcp dev for MCP Inspector, and serves Streamable HTTP:

tier-mcp-sdk /path/to/docs
python3 -m tier.mcp.sdk_server /path/to/docs --transport streamable-http --host 127.0.0.1 --port 8000
mcp dev src/tier/mcp/sdk_server.py

Without the extra, tier-mcp-sdk prints the exact pip install "tier[mcp]" command and exits cleanly. The default tier-mcp / python -m tier.mcp server remains the zero-dependency stdlib JSON-RPC implementation.

CLI

Command

Purpose

tier install, tier setup

Interactive/non-interactive MCP client installer

tier doctor

Environment, config, repo, and sync diagnostics

tier index FILE

L0 + L1 index with token and rule counts

tier find FILE QUERY

Hybrid identifier/synonym/trigram search

tier get FILE ID...

Fetch sections; --follow, --table raw|aligned|anchored

tier slice FILE MODULE SYMBOL...

Exact L3 source lines

tier impact FILE TARGET

Forward/reverse dependency and Git blast radius

tier from-repo PATH

Build a polyglot repository map

tier sync FILE

Incremental fingerprint-based refresh

tier remember FILE

Atomic write-back memory

tier pipe

Compress stdin JSON/Markdown/logs with an optional budget

tier hook

Claude Code-style PostToolUse JSON filter

tier lint FILE

Structural validation

tier from-md FILE / to-md / to-json / compress

Format conversion

tier init-plugin TARGET

Legacy one-command MCP + repo + hook setup

tier stats FILE

Token cost per layer/section

MCP tools

tier_list, tier_index, tier_find, tier_get, tier_slice, tier_impact, tier_sync, tier_lint, tier_ingest, tier_repo, tier_remember.

Start the default server with tier-mcp /path/to/root or python3 -m tier.mcp /path/to/root. All paths are confined to the configured root; live repository edits auto-sync before reads.

Privacy, Zero Telemetry & Contributing

TIER runs entirely on your machine. There are no telemetry, analytics, API keys, or network calls in the core runtime. The MCP server is path-sandboxed, repository scans reject symlinks escaping the root, and memory writes are validated before an atomic replace. The optional [mcp] Streamable HTTP transport is the only network listener, and only when you explicitly start it.

python3 -m unittest discover -s tests -q     # 88 tests
tier doctor .                                # 10 checks: 0 failed, 0 warnings
python3 benchmarks/bench.py                  # Tracks A-I; writes benchmarks/BENCH.txt
tier from-repo . -o repo.tier                # refresh the checked-in self-index
tier lint repo.tier && tier lint SPEC.tier

Limits. Only token counts, retrieval identifiers, and exact-slice coverage are measured — not LLM answer accuracy. Claude's tokenizer is not public; counts use OpenAI o200k (or a character estimate when Node is unavailable). JS/TS/Go/Rust symbol extraction is heuristic, not a full parser. A --max-tokens budget below the saved artifact-path cost is best-effort.

License

MIT © 2026 000jd. See LICENSE.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      A
      maintenance
      An MCP server that provides structural codebase indexing and surgical query tools to drastically reduce token usage through symbol-level searches and transitive impact analysis. It supports multiple languages and integrates with git to help AI agents understand code dependencies and the impact of changes in sub-millisecond time.
      72
      486 PyPI
      1,217
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      An MCP server giving coding agents context-window-aware code search and safe, atomic multi-file edits — built to cut token usage on large codebases without sacrificing correctness.
      3
      68 npm
      5
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Serves structured code context via MCP, enabling AI agents to understand codebases with dependency graphs and significantly reduce token usage.
      13 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      An MCP server that indexes codebases into a local graph and provides on-demand context retrieval for AI coding agents, reducing token usage by tracking session history and delivering only relevant code subgraphs.
      4 npm
      MIT