|
| 1 | +# Copilot CLI Port — Architecture Mapping |
| 2 | + |
| 3 | +How Quorum's reference implementation components map to Copilot CLI primitives. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## Component-Level Mapping |
| 8 | + |
| 9 | +### Supervisor → SKILL.md Orchestration |
| 10 | + |
| 11 | +The reference implementation's `supervisor.py` selects critics based on depth profile and artifact type. In the Copilot port, this logic moves into SKILL.md as natural language instructions that Copilot follows to orchestrate the validation flow. |
| 12 | + |
| 13 | +``` |
| 14 | +Reference: supervisor.py → selects critics → ThreadPoolExecutor → collects results |
| 15 | +Copilot: SKILL.md instructions → spawns task agents → collects responses |
| 16 | +``` |
| 17 | + |
| 18 | +### Critics → Task Agents |
| 19 | + |
| 20 | +Each critic's system prompt + rubric injection becomes a `task` agent call: |
| 21 | + |
| 22 | +```python |
| 23 | +# Reference implementation (simplified) |
| 24 | +critic_result = litellm.completion( |
| 25 | + model=config.tier2_model, |
| 26 | + messages=[system_prompt + rubric + artifact] |
| 27 | +) |
| 28 | + |
| 29 | +# Copilot CLI equivalent (conceptual) |
| 30 | +critic_result = task( |
| 31 | + agent_type="explore", # or "general-purpose" for security |
| 32 | + model="sonnet", |
| 33 | + prompt=system_prompt + rubric + artifact |
| 34 | +) |
| 35 | +``` |
| 36 | + |
| 37 | +### Pre-Screen → Script Execution |
| 38 | + |
| 39 | +The pre-screen layer runs identically — it's already a Python script that shells out to external tools: |
| 40 | + |
| 41 | +``` |
| 42 | +Reference: quorum run → pre_screen.py → [DevSkim, Ruff, Bandit, PSSA] |
| 43 | +Copilot: SKILL.md → python quorum-prescreen.py → [DevSkim, Ruff, Bandit, PSSA] |
| 44 | +``` |
| 45 | + |
| 46 | +**Key difference:** Pre-screen must be stdlib-only for the port. The reference implementation uses pyyaml for config parsing — make it optional with JSON fallback. |
| 47 | + |
| 48 | +### Aggregator → SKILL.md Logic or Dedicated Agent |
| 49 | + |
| 50 | +The aggregator merges findings, resolves conflicts, and assigns verdicts. Two options: |
| 51 | + |
| 52 | +1. **Inline in SKILL.md** — aggregation logic as natural language instructions. Simpler, fewer premium requests. |
| 53 | +2. **Dedicated agent** — `general-purpose` agent with aggregator prompt. More robust for complex conflict resolution. |
| 54 | + |
| 55 | +Recommendation: Start with option 1, move to option 2 if quality suffers. |
| 56 | + |
| 57 | +### Fixer → General-Purpose Agent |
| 58 | + |
| 59 | +The fixer needs write access to propose changes: |
| 60 | + |
| 61 | +``` |
| 62 | +Reference: fixer.py → reads findings + artifact → proposes text replacements → writes fix-proposals.json |
| 63 | +Copilot: general-purpose task agent → reads findings + artifact → proposes changes → writes to disk |
| 64 | +``` |
| 65 | + |
| 66 | +### Learning Memory → File Persistence |
| 67 | + |
| 68 | +`known_issues.json` is read at session start and written after verdict. Files persist across Copilot sessions — no changes needed to the data format. |
| 69 | + |
| 70 | +### Cost Tracking → Not Applicable |
| 71 | + |
| 72 | +LiteLLM cost tracking doesn't apply. Copilot uses premium requests, not per-token billing. The port should track premium request count instead. |
| 73 | + |
| 74 | +### Batch Validation → Sequential Task Dispatch |
| 75 | + |
| 76 | +The reference implementation's batch mode processes multiple files with crash-resilient progressive saves. In Copilot: |
| 77 | + |
| 78 | +``` |
| 79 | +Reference: BatchVerdict → ThreadPoolExecutor(max_workers=3) → progressive manifest |
| 80 | +Copilot: SKILL.md loops over files → sequential or parallel task dispatch → progressive file writes |
| 81 | +``` |
| 82 | + |
| 83 | +--- |
| 84 | + |
| 85 | +## Prompt Extraction Guide |
| 86 | + |
| 87 | +When extracting critic prompts from Python classes, preserve: |
| 88 | + |
| 89 | +1. **System prompt** — the critic's identity, evaluation criteria, and output format requirements |
| 90 | +2. **Rubric injection** — how rubric criteria are formatted and injected into the prompt |
| 91 | +3. **Evidence grounding instruction** — the requirement to cite specific locus (file, line, excerpt) for every finding |
| 92 | +4. **Output schema** — the JSON structure critics must return (findings array with severity, location, criterion, evidence) |
| 93 | + |
| 94 | +Do NOT extract: |
| 95 | +- LiteLLM-specific code (model routing, retry logic, cost tracking) |
| 96 | +- ThreadPoolExecutor orchestration (replaced by `task` agents) |
| 97 | +- File I/O wrappers (Copilot agents handle file operations natively) |
| 98 | + |
| 99 | +--- |
| 100 | + |
| 101 | +## Testing Strategy |
| 102 | + |
| 103 | +### Equivalence Testing |
| 104 | + |
| 105 | +For each critic, run the same artifact through both: |
| 106 | +1. Reference implementation (`quorum run --target <file> --depth standard`) |
| 107 | +2. Copilot CLI port (natural language invocation) |
| 108 | + |
| 109 | +Compare: finding count, severity distribution, evidence quality, verdict. They should converge but won't be identical (different model access patterns, prompt formatting). |
| 110 | + |
| 111 | +### Regression Artifacts |
| 112 | + |
| 113 | +Use the reference implementation's existing test artifacts: |
| 114 | +- `examples/sample-research.md` — planted flaws for research validation |
| 115 | +- `examples/bad-config.yaml` — planted security + completeness issues |
| 116 | +- Golden set artifacts (if graduated to public) |
| 117 | + |
| 118 | +### Platform-Specific Testing |
| 119 | + |
| 120 | +- Windows native PowerShell (primary) |
| 121 | +- WSL (secondary) |
| 122 | +- macOS Terminal (tertiary) |
| 123 | +- Linux (tertiary) |
0 commit comments