Skip to content

Refactor: clarify context passing mechanism between create-expert delegates #382

@FL4TLiN3

Description

@FL4TLiN3

Description

The create-expert framework passes context between delegates (properties, test results, ecosystem info), but the mechanism is unclear from the instructions.

Current State

create-expert (coordinator):

## Important
- Pass context between delegates (properties, test results, ecosystem info)

report-generator:

## Input
- Original requirements
- Extracted properties
- Test results from all stages (including usability)
- Expert ecosystem information

Issues:

  1. "Pass context between delegates" - how? Via query string? Via workspace files?
  2. report-generator expects 4 types of input but doesn't explain how to receive them
  3. Per Perstack design, delegates start with empty history and only receive the query

From docs/understanding-perstack/experts.md:

Context is never shared between Experts. The delegate receives only the query — no message history, no parent context.

This means all context must be passed via:

  • The query string itself (inline JSON or structured text)
  • Workspace files

Target State

Make the context-passing mechanism explicit:

Option A: Query-based (inline context)

instruction = '''
## Context Passing
When delegating, include context in the query:
- Property extraction: "Requirements: [original requirements]"
- Ecosystem building: "Properties: [JSON of extracted properties]"
- Report generation: Include JSON with all accumulated data

Example delegation query:
"Generate report with:
- Requirements: [...]
- Properties: [...]
- Test results: [...]"
'''

Option B: Workspace-based (file context)

instruction = '''
## Context Passing
Use workspace files for accumulated state:
- property-extractor writes: .perstack-context/properties.json
- ecosystem-builder reads properties, writes: .perstack-context/ecosystem.json
- integration-manager reads both, writes: .perstack-context/test-results.json
- report-generator reads all files to generate final report
'''

Affected Areas

  • apps/create-expert/src/lib/create-expert-toml.ts
  • All expert instructions that pass or receive context

Acceptance Criteria

  • Context-passing mechanism is explicitly documented
  • Aligns with Perstack context isolation design
  • Each delegate knows where to find its inputs
  • Each delegate knows where to store its outputs

Metadata

Metadata

Assignees

No one assigned

    Labels

    create-expertcreate-expert CLI packagerefactorCode improvement without behavior change

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions