Skip to content

Add multi-resolution context representations for nodes and slices #76

@mohanagy

Description

@mohanagy

Goal

Allow graphify-ts to represent the same selected node at different detail levels, instead of always emitting code snippets or the same graph record format.

Why

The best context pack is not all source code and not all summaries. It should spend exact source tokens only where they matter, and use cheaper representations elsewhere.

Proposed representation levels

L0 repo/package/module map
L1 file summary
L2 symbol signature
L3 behavior sketch
L4 dependency-only record
L5 exact source lines

Examples

Full exact source only when needed

Use exact source for:

  • changed lines
  • stack trace locations
  • suspicious conditions
  • public contracts
  • compact high-value functions
  • code the agent likely needs to edit

Behavior sketch for supporting nodes

Example:

ReportGenerationService.generate(input)
→ InputNormalizer.normalize
→ RedditAgent.research
→ WebAgent.research
→ ScoringService.score
→ ReportBuilder.build
Side effects: external search, LLM call, DB write
Risk: latency/cost dominated by research agents

Dependency-only record

Example:

SessionService.createSession
calls: TokenService.sign, CookieService.set
reads env: AUTH_COOKIE_DOMAIN, SESSION_TTL
called by: AuthController.handleCallback
covered by: session.service.spec.ts

Deliverables

  • Representation model/types
  • Renderer for each representation level
  • Token estimate per representation
  • Selection integration with budgeted packer
  • Tests showing the same node can be emitted as sketch/signature/exact source depending on task and budget

Acceptance criteria

  • Context pack can mix exact code, behavior sketches, summaries, and dependency records
  • Exact code is not the default for every selected node
  • Renderer output is deterministic
  • Each emitted item says why this representation level was chosen
  • Tests prove a lower-budget pack downgrades supporting nodes before dropping critical evidence

Suggested labels

enhancement, context-quality, performance, prompt-compiler

Metadata

Metadata

Assignees

No one assigned

    Labels

    context-qualityQuality of the compiled context packenhancementNew feature or requestperformanceRuntime, latency, throughput, or token-cost workprompt-compilerProvider-aware prompt compilation surface

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions