Skip to content

context: implement the typed repo graph and role-scoped work-item packet compiler #1632

Closed as not planned

Description

@EffortlessSteven

Parent

Existing foundation

docs/agent-context/CONTEXT_SYSTEM.md already defines the missing architecture:

  • typed nodes/edges over proposals, specs, ADRs, campaigns, work items, surfaces, modules, fixtures, output contracts, metrics, validation commands, receipts, handoffs, and learnings;
  • proposed manifests under .ripr/context/;
  • proposed generated context-index.{json,md} and work-item-packet.{json,md};
  • proposed commands for validation, indexing, path routing, packet generation, and staleness checks;
  • the explicit failure mode that agents currently read too much because links are implicit, or too little because they do not know a relevant contract exists.

Search of current main shows the doctrine exists, but the manifests and command implementation do not. A Codex root thread therefore has to parse long Markdown documents and reconstruct the graph in its own context before it can delegate anything.

Required outcome

Implement the doctrine as a deterministic, read-only repo context compiler. It must reuse the accepted source-of-truth control plane and active-goal authority rather than add a second planning hierarchy.

Machine-readable manifests

Add the proposed, verified manifests:

.ripr/context/surfaces.toml
.ripr/context/doc-types.toml
.ripr/context/validation.toml
.ripr/context/context-routes.toml

They should express only relationships not already owned elsewhere. Existing proposal/spec/ADR/goal/traceability/support-tier identities remain authoritative; manifests link them rather than restating their content.

At minimum, surfaces.toml must support:

surface id
owned/relevant code path globs
risk class
required and recommended document identities
fixture/golden/report families
minimum and full validation routes
semantic conflict resources
IDE/navigation labels

Commands

Implement repository-native commands equivalent to:

cargo xtask check-doc-context
cargo xtask context index
cargo xtask context query --surface <id>
cargo xtask context route --changed-path <path> [...]
cargo xtask context packet --work-item <id> [--role <role>] [--json]
cargo xtask context stale

Command names may follow the existing catalog, but the capabilities must remain distinct.

Snapshot identity

Every packet binds one reconciled input identity:

repository root identity
base and head commit SHA
working-tree state = clean | dirty with explicit changed paths
active goal content digest
selected work-item id and content digest
linked plan/spec/ADR/traceability identities
context-manifest schema/version and content digest
packet role and budget profile

Volatile generation time and absolute checkout spelling stay outside portable semantic identity.

Role-scoped packet views

Generate a common work-item packet plus bounded views for:

orchestrator
scout
adversary
builder
verifier
reviewer

The common packet carries the existing doctrine fields:

objective
current state
target state
acceptance criterion
production delta
evidence delta
non-goals
stop/ask-back conditions
dependencies and landing order
read-first documents
relevant code, fixtures, goldens, reports, and receipts
minimum proof commands and full gate
PR summary seed

Role views remove irrelevant material rather than merely append role instructions:

  • scout: question, surface map, search/evidence targets, read-only boundary, result schema;
  • adversary: claimed premise/result plus exact discrepancy questions, not the scout's raw notes;
  • builder: accepted premise, edit cage, implementation/test surfaces, stop conditions, no broad history;
  • verifier: claimed change, diff/commit identity, proof commands, expected artifacts, no author conclusion;
  • reviewer: change and evidence contract, risks/invariants, residual assumptions.

Deterministic context budgets

Define versioned profiles with caps for:

inline bytes
document references
source/fixture paths
embedded snippets
validation commands
result rows

The packet is references-first. Large documents, logs, diffs, and reports are represented by stable entries containing:

artifact/path
line or JSON-pointer range when available
content digest
why relevant
retrieval command

When a budget is exceeded, emit:

complete = false
selected / omitted / total counts
omission reasons
stable overflow index and retrieval routes

Never silently truncate or summarize an omitted required contract as if it had been read.

Acceptance

  • A work-item fixture spanning spec, code, tests, output contract, metric, and validation produces a schema-valid role-neutral packet and six role views.
  • The orchestrator packet is materially smaller than concatenating all linked documents and reports; the fixture records both byte counts.
  • Scout and verifier packets do not contain builder-only implementation prose or raw command logs.
  • Builder packets include every required acceptance/non-goal/edit-cage fact and fail closed when a linked required contract is missing.
  • context route --changed-path returns deterministic surfaces and validation routes for Rust, VS Code, workflow, policy, LSP, fixture/golden, docs-only, and release-sensitive examples.
  • Reordering TOML entries, filesystem traversal, or graph input iteration does not change normalized packet identity.
  • Equivalent checkouts at different absolute roots produce the same portable graph/packet identity.
  • Dirty working-tree state is explicit and changes the session packet identity; it is never presented as a clean base.
  • Missing links, duplicate identities, unsupported node/edge values, path escapes, stale active goals, and contradictory authority are fixture-backed failures.
  • Generated Markdown is a human projection of the JSON DTO, not a second decision path.
  • Command-catalog, doc-index, traceability, and source-of-truth checks cover the new surface.

Non-goals

  • No task decomposition by a model.
  • No provider/model invocation.
  • No committed subagent task ledger.
  • No source editing, worktree creation, claim acquisition, or command execution.
  • No replacement for proposals, specs, active goals, traceability, support tiers, or PR bodies.
  • No full-text repository index or vector database.

Likely seams

  • docs/agent-context/CONTEXT_SYSTEM.md
  • .ripr/context/*
  • .ripr/goals/active.toml parser/reports
  • source-of-truth graph/report helpers
  • xtask/src/command.rs, dispatch, and a focused context module
  • schema/golden fixtures under a bounded context corpus

Relationships

Claim boundary

This issue makes relevant repository context bounded, typed, and reproducible. It does not prove the selected work is correct, choose a business priority, perform delegation, or verify a worker's claims.

Activity

  1. EffortlessSteven commented on Jul 14, 2026

    @EffortlessSteven
    MemberAuthor

    Relationship correction for the body’s generated numbering:

    The self-reference in the original Relationships section is a numbering typo; it is not a dependency cycle.

  2. EffortlessSteven commented on Jul 15, 2026

    @EffortlessSteven
    MemberAuthor

    Issue update — 2026-07-14

    Title: context: implement the typed repo graph and role-scoped work-item packet compile

    Status

    This issue is part of the Codex orchestration epic (#1631) — context-compiled, conflict-safe subagent orchestration. Based on codebase research:

    Recommendations

    1. Priority: low-medium. This is a future capability, not a current blocker.
    2. The epic depends on typed repo graph (context: implement the typed repo graph and role-scoped work-item packet compiler #1632) and subtask packet contracts (orchestration: define versioned SubtaskPacket, SubtaskResult, and verification receipt contracts #1633) as foundations.
    3. Adversarial review: Orchestration must not become a parallel authority — it composes ripr evidence, it does not re-analyze.
  3. EffortlessSteven commented on Jul 15, 2026

    @EffortlessSteven
    MemberAuthor

    Prerequisite: #1692 must land before this packet compiler becomes implementation-ready. Replace active-goal authority and active-goal content digest in packet identity with repository/current-main, portfolio snapshot, selected issue/work-item, accepted contract, and relevant campaign references. A campaign may remain context, but it must not silently select work.

  4. EffortlessSteven commented on Jul 15, 2026

    @EffortlessSteven
    MemberAuthor

    Contract correction and prerequisite

    Depends on #1697 → #1701 → #1704 for final authority and portfolio identity. Coordinate the shared DTO migration through #1706.

    The packet snapshot must no longer include active goal content digest as current-work authority. Use:

    repository + current main
    + PortfolioBasis
    + SelectedWorkIdentity
    + relevant campaign/spec/requirement/implementation-slice refs
    + overlapping live work
    + role/budget profile
    

    A campaign reference is durable context only. A selected issue may have zero, one, or several relevant campaigns. Missing campaign placement does not block a qualified one-PR repair.

    Legacy active-goal fields may be accepted only as explicit read-only compatibility references and must never authorize a builder, verification claim, support promotion, or completion.

    Add fixtures for standalone selected issue, multi-campaign context, wrong repository/portfolio/issue identity, and fresh-session resume without active.toml authority.

  5. EffortlessSteven commented on Jul 17, 2026

    @EffortlessSteven
    MemberAuthor

    Codebase Context & Plan Review

    Reviewed: 2026-07-17

    Current Implementation State

    No implementations currently exist for .ripr/context/ manifests or xtask context commands. The repo currently tracks plans via �ctive.toml and markdown files, but no machine-readable compiler exists.

    Relevant Files

    • .ripr/context/ — Needs to be created for surfaces.toml, doc-types.toml, etc.
    • xtask/src/command.rs — Will need to add Context enum and logic.
    • docs/agent-context/CONTEXT_SYSTEM.md — The existing doctrine for the architecture.

    Plan Review

    The plan is highly coherent and clearly matches the goals set in the parent epic #1631. Adding typed machine-readable context scopes (Scout, Adversary, Builder, Verifier, Reviewer) and explicit byte limits/budgets will significantly prevent LLM context-overflow.

    Blockers

    None.

    Readiness Assessment

    ready-to-implement

    Next Action

    Implement the .ripr/context/ manifests and cargo xtask context subcommands.

  6. EffortlessSteven commented on Jul 18, 2026

    @EffortlessSteven
    MemberAuthor

    Deep Research Follow-up

    Reviewed: 2026-07-17

    Current Implementation State

    The codebase contains documentation outlining the orchestration principles (docs/AGENT_OPERATING_MODEL.md, docs/CODEX_GOALS.md, docs/agent-context/CONTEXT_SYSTEM.md), but the typed repo graph and work-item packet compiler do not currently exist in code. ContextPacket exists in crates/ripr/src/domain/context_packet.rs, but it is tied to LSP analyzer evidence, not Codex orchestration.

    Relevant Files

    • docs/agent-context/CONTEXT_SYSTEM.md — architectural doctrine for the repo graph.
    • xtask/src/main.rs — orchestrator CLI entry point, missing check-doc-context, context index, etc.
    • crates/ripr/src/domain/context_packet.rs — existing LSP ContextPacket, distinct from the planned work-item packets.

    Plan Review

    The plan is highly coherent. It distinguishes between the existing analyzer-evidence protocol (ContextPacket for LSP) and the net-new orchestration packets (role-scoped views, deterministic context budgets). The proposal safely reuses existing source-of-truth mechanisms (specs, active goals) rather than creating a parallel task hierarchy.

    Blockers

    No immediate codebase blockers. This is greenfield implementation within xtask (or a dedicated context crate).

    Readiness Assessment

    ready-to-implement

    Next Action

    Begin implementing the TOML manifest schemas for .ripr/context/ and the base cargo xtask context commands.

  7. EffortlessSteven commented on Jul 18, 2026

    @EffortlessSteven
    MemberAuthor

    Status review (2026-07-17)

    Codebase review against current main. Read-only; no code changed.

    Current status: not-started (design/spec only), blocked on #1692. Per AGENTS.md:582-587, this is explicitly not an assumed command surface — the commands it names do not exist.

    Evidence nothing landed

    • .ripr/context/ directory does not exist. None of the proposed manifests (surfaces.toml, doc-types.toml, validation.toml, context-routes.toml) exist.
    • No context subcommand in xtask/src/command.rs (grep for check-doc-context, context index|query|route|packet|stale → nothing).
    • docs/agent-context/CONTEXT_SYSTEM.md is status: proposed.
    • The existing ContextPacket struct at crates/ripr/src/domain/context_packet.rs is the LSP analyzer evidence packet (probe/reach/infect/discriminate) — a different domain type, explicitly not this issue's work-item packet.

    The #1631/#1692 supersession applies directly

    Per the authority-correction on the parent, #1632 packets must bind PortfolioBasis + SelectedWorkIdentity, not an active-goal digest. So this issue's stated snapshot-identity section needs rewrite before implementation.

    Recommended next step

    Produce the manifest schemas + a STATUS: proposed→accepted spec/ADR first; resolve #1692 portfolio identity; then implement the read-only compiler as the first slice. The read-only, deterministic packet compiler is a sensible first artifact once identity is stable. Do not reuse the LSP ContextPacket type — different domain.

  8. added
    status/blocked-upstream
    on Jul 18, 2026
  9. EffortlessSteven commented on Aug 2, 2026

    @EffortlessSteven
    MemberAuthor

    Earnest review (2026-08-02)

    Context: typed repo graph + role-scoped work-item packet compiler. Slice #1786 (read-only repo-context packet compiler, PortfolioBasis-bound) is the execution.

    Action: keep open; track via #1786. PortfolioBasis is not yet in src, so this is foundational.

  10. EffortlessSteven commented on Aug 3, 2026

    @EffortlessSteven
    MemberAuthor

    Deep re-review (2026-08-02)

    STATUS: stale
    EVIDENCE: status/blocked-upstream. (Context: implement typed repo graph + role-scoped work-item packet compiler.) grep -rniE 'repo.graph|work.item.packet|packet.compiler|role.scoped.packet' crates/ xtask/ -> 0 hits; no packet compiler. #1731 owns the .ripr/context/*.toml manifest schemas this reads — and those manifests don't exist (ls .ripr/context/ -> absent). 'Role-scoped packets' implies the role roster forbidden by AGENTS.md:576-579. Blocked upstream + doctrine-constrained.
    PLAN QUALITY: needs-update
    ACTION: update (depends on re-baselined #1631 + #1731 manifests; the role-scoped framing needs to drop per AGENTS.md:576-579)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status/blocked-upstream

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions