Orchestrata Ultimate › Plans › plan_automated_porting_harness › subplan-step1-scope-object-context-builder-2026-04-11

Subplan Step 1: Scope Object + Context Builder

Source: plans/plan_automated_porting_harness/subplan-step1-scope-object-context-builder-2026-04-11.md at 8a2cb42ad · last changed 2026-07-27 · first committed 2026-04-11 · 40 lines.

Prose pending.

Plan text

Subplan Step 1: Scope Object + Context Builder

Prerequisite: subplan-step0 (AST serializer extension + Neo4j sync) must be complete and all 14 verification queries passing. Parent: master-plan.md (Automated Porting Harness)

Status: NOT STARTED — waiting for Step 0 verification

Scope

  1. Build the Scope class — loads a class's full subgraph from Neo4j in ONE query into an in-memory object. All questions answered from memory traversal, zero additional Neo4j calls.

  2. Build graph_client.py — thin Neo4j driver wrapper that Scope uses for the initial load.

  3. Build context_builder.py — calls graph.load(project, class_name) to get a Scope, formats data for prompt injection. Replaces all heuristic grep in harness.

  4. Rewrite harness prompt templates to inject Scope-derived context.

  5. Wire into harness cli.py + add incremental re-sync after each step merge.

Key Design Decision

The Scope object is an in-memory subgraph loaded once per step. The volk works on one class at a time. At dispatch time:

scope = graph.load("orchestrata", "BaseVolk")

# Everything answered from memory — zero more network calls:
scope.services()              # walks in-memory call tree for redis/neo4j/etc.
scope.constructor()           # __init__ method's statements
scope.validators()            # methods with @field_validator decorators
scope.raises()                # walks statements for Raise nodes
scope.accumulating_vars()     # ClassVars with ClassVar[dict]/ClassVar[list]
scope.stub_methods()          # methods where body is just Pass
scope.env_var_accesses()      # statements referencing os.environ
scope.ultimate_pair()         # MAPS_TO target class loaded in same query

Object stays alive for the duration of one step. Porter, Tester, Fixer all use the same Scope. New Scope loaded per step.

Detailed design: TBD after Step 0 is verified