Skip to main content
The Iris Gate Ladder is the core innovation of SDL-MCP. Named after the adjustable aperture that controls light flow in optics, it lets agents dial their context window from a pinhole to wide-open — only as much as each question actually requires.

The Problem It Solves

When an AI coding agent needs to understand a function, the default approach is to read the entire file. A 500-line file consumes roughly 2,000 tokens — even if the answer is in a 3-line signature. Across a debugging session touching 20 files, that’s 40,000+ tokens burned on context gathering alone, most of it noise. The Iris Gate Ladder eliminates this waste by providing four levels of context access, each appropriate for a different class of question. Agents start at the lowest rung and escalate only when the current rung can’t answer the question.

The Four Rungs

Token CostRungWhat You GetTypical Question
~1001 — Symbol CardName, signature, summary, deps, metrics”What does this function do?”
~3002 — Skeleton IRSignatures + control flow, bodies elided”What’s the shape of this class?”
~6003 — Hot-Path ExcerptLines matching specific identifiers + context”Where is this.cache initialized?”
~2,0004 — Raw Code WindowFull source code, policy-gated”I need to rewrite this error handler”

Rung 1: Symbol Cards (sdl.symbol.getCard)

The atom of SDL-MCP. A symbol card is a compact metadata record containing everything an agent needs to understand a symbol without reading its code:
  • Identity — name, kind (function/class/interface/etc.), file, line range
  • Signature — parameter names and types, return type, generics, overloads
  • Summary — 1–2 line semantic description (LLM-generated or extracted)
  • Dependencies — what it imports and calls (with confidence-scored resolution)
  • Metrics — fan-in (who calls me), fan-out (who I call), 30-day churn, test references
  • Architecture — cluster membership (community detection), process participation (call-chain role)
  • Versioning — content-addressed ETag for conditional requests
Most questions are answered here. “What does buildSlice do?” “What does handleAuth depend on?” “Is parseConfig exported?” All answered by a card, at ~100 tokens.

Rung 2: Skeleton IR (sdl.code.getSkeleton)

When you need to understand the shape of a file or class without reading every line. Skeletons include all function and method signatures, control flow structures (if, for, while, try/catch), and implementation bodies replaced with /* ... */. Think of it as an interactive table of contents. You can also filter with exportedOnly: true for large library files.

Rung 3: Hot-Path Excerpt (sdl.code.getHotPath)

When you know what you’re looking for. Provide a list of identifiers — for example, ["errorCode", "retryCount"] — and get back only the lines where they appear, plus a configurable number of context lines above and below. Everything else is skipped. This is surgically precise: you see exactly the code you need and nothing more.

Rung 4: Raw Code Window (sdl.code.needWindow)

The last resort. Full source code access, but with guardrails:
  • Justification required — agents must explain why they need raw code
  • Identifier hints — what specific identifiers they expect to find
  • Line and token limits — enforced by the policy engine
  • Audit logging — every raw access is recorded
  • Denial guidance — if denied, the response suggests an alternative (e.g., “try getHotPath with these identifiers instead”)
Policy-gated raw access ensures agents prove they actually need full source. Denied requests always include an actionable next-best-action suggestion.

Token Savings in Practice

ScenarioReading the FileUsing the LadderSavings
”What does parseConfig accept?”~2,000 tokens~100 (card)20x
”Show me the structure of AuthService~4,000 tokens~300 (skeleton)13x
”Where is this.cache set?”~2,000 tokens~500 (hot-path)4x
”Debug the retry logic in fetchWithBackoff~2,000 tokens~2,000 (window)1x (but audited)
Across a typical 30-tool debugging session, the ladder saves 10–50x tokens compared to naive file reads.

The Escalation Path

Agents navigate the ladder by starting at Rung 1 and climbing only when the current rung cannot answer the question. Each rung is a complete tool call with its own response:
1

Ask the Symbol Card

Call sdl.symbol.getCard with the symbol’s ID. The card contains signature, summary, dependencies, and metrics — enough to answer most questions about what a symbol does and what it calls.
{
  "tool": "sdl.symbol.getCard",
  "arguments": { "repoId": "my-app", "symbolId": "validateToken" }
}
2

Escalate to Skeleton IR

If the card answers identity and dependencies but you need to understand the structure of the file or class, call sdl.code.getSkeleton. Bodies are elided — you see the control flow and all signatures without the implementation noise.
{
  "tool": "sdl.code.getSkeleton",
  "arguments": { "repoId": "my-app", "file": "src/auth/jwt.ts" }
}
3

Escalate to Hot-Path Excerpt

If you need specific lines — where a variable is assigned, where a condition branches — call sdl.code.getHotPath with the identifiers you’re tracking. Only the matching lines and their context are returned.
{
  "tool": "sdl.code.getHotPath",
  "arguments": {
    "repoId": "my-app",
    "file": "src/auth/jwt.ts",
    "identifiers": ["this.cache", "cacheKey"],
    "contextLines": 3
  }
}
4

Request Raw Code Window (Policy-Gated)

Only if you need to read or rewrite the full implementation, call sdl.code.needWindow. Provide a reason, the identifiers you expect to find, and your expected line count. The policy engine validates the request and either approves it or returns a denial with an alternative suggestion.
{
  "tool": "sdl.code.needWindow",
  "arguments": {
    "repoId": "my-app",
    "file": "src/auth/jwt.ts",
    "reason": "Need to rewrite the error handling branch in validateToken",
    "identifiers": ["JwtError", "catchBlock"],
    "maxLines": 100
  }
}

MCP Tool Mapping

RungMCP ToolWhen to Use
1sdl.symbol.getCard / sdl.symbol.getCardsUnderstanding what a symbol does, its deps, its metrics
2sdl.code.getSkeletonUnderstanding the shape of a file or class
3sdl.code.getHotPathFinding where specific identifiers appear
4sdl.code.needWindowReading or rewriting a full implementation
Use sdl.slice.build to retrieve Rung 1 cards for an entire task context (multiple symbols) in a single call. This is the most efficient way to gather context at the start of a task.

Build docs developers (and LLMs) love