Skip to content

Commit c638202

Browse files
authored
Merge pull request #13 from SharedIntellect/feature/copilot-cli-port
feat: Copilot CLI port — Quorum validation as a GitHub Copilot skill
2 parents 3c739fb + c2fed2e commit c638202

14 files changed

Lines changed: 2530 additions & 1 deletion

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
docs/external-reviews/
2-
ports/
32
__pycache__/
43
.pytest_cache/
54
.hypothesis/

docs/CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ All notable changes to Quorum will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
66

7+
## [0.7.0-port.1] — 2026-03-12
8+
9+
### Added
10+
- **Copilot CLI port** at `ports/copilot-cli/` — Quorum's multi-critic validation framework packaged as a GitHub Copilot CLI skill. Zero infrastructure, zero pip dependencies.
11+
- `SKILL.md` (414 lines): Orchestrator skill — artifact classification, rubric selection, prescreen gating, critic dispatch, verdict aggregation, report generation.
12+
- `quorum-prescreen.py` (649 lines): Stdlib-only pre-screen implementing PS-001 through PS-010. PyYAML optional for YAML artifact support.
13+
- 5 critic `.agent.md` files: Verbatim prompts for correctness, completeness, security, code hygiene, and cross-consistency critics.
14+
- 3 rubric JSON files: Byte-identical copies from reference implementation (python-code, research-synthesis, agent-config).
15+
- `README.md`: Install and usage guide.
16+
- `ARCHITECTURE.md`: Port design rationale and mapping to reference implementation.
17+
18+
### Changed
19+
- `.gitignore`: Removed `ports/` exclusion — ports are now tracked for public release.
20+
721
## [0.7.0] — 2026-03-12
822

923
### Added

ports/copilot-cli/ARCHITECTURE.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
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)

ports/copilot-cli/README.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Quorum — Copilot CLI Skill
2+
3+
Multi-critic quality validation for code, configs, and documentation.
4+
5+
## Install
6+
7+
```bash
8+
git clone https://github.com/SharedIntellect/quorum
9+
cp -r quorum/ports/copilot-cli ~/.copilot/skills/quorum
10+
```
11+
12+
## Usage
13+
14+
### Full validation (all critics)
15+
"Run Quorum validation on this file"
16+
"Validate api_handler.py with Quorum"
17+
18+
### Single critic
19+
"Run the security critic on auth.py"
20+
"Check this config for completeness"
21+
22+
### Cross-artifact consistency
23+
"Check if implementation.py matches spec.md"
24+
25+
## What It Checks
26+
- **Correctness** — Logic errors, contradictions, false claims
27+
- **Completeness** — Missing sections, edge cases, broken promises
28+
- **Security** — OWASP ASVS 5.0, CWE Top 25, framework-grounded
29+
- **Code Hygiene** — ISO 25010/5055, structural quality beyond linting
30+
- **Cross-Consistency** — Spec/impl, docs/code, schema contracts
31+
32+
## Verdict Scale
33+
- **PASS** — No issues found
34+
- **PASS_WITH_NOTES** — Minor issues only (MEDIUM/LOW)
35+
- **REVISE** — HIGH severity issues requiring rework
36+
- **REJECT** — CRITICAL issues found
37+
38+
## Requirements
39+
- GitHub Copilot CLI with skill support
40+
- Python 3.10+ (for pre-screen script)
41+
- No additional dependencies
42+
43+
## Skill Structure
44+
45+
```
46+
~/.copilot/skills/quorum/
47+
├── SKILL.md # Orchestration (Copilot reads this)
48+
├── quorum-prescreen.py # Stdlib-only pre-screen script
49+
├── rubrics/
50+
│ ├── python-code.json # 25 criteria for Python code
51+
│ ├── research-synthesis.json # Research report criteria
52+
│ └── agent-config.json # Config/YAML criteria
53+
└── critics/
54+
├── correctness.agent.md # Direct single-critic invocation
55+
├── completeness.agent.md
56+
├── security.agent.md
57+
├── code-hygiene.agent.md
58+
└── cross-consistency.agent.md
59+
```
60+
61+
## What Changes vs Reference Implementation
62+
- LiteLLM provider -> Copilot `task` tool for parallel dispatch
63+
- ThreadPoolExecutor -> Copilot parallel `task` calls
64+
- CLI arguments -> natural language invocation
65+
- Config YAML depth profiles -> SKILL.md instructions
66+
- Python package -> file-based skill (SKILL.md + scripts + rubrics)
67+
- Pydantic models -> plain JSON (in prescreen script)
68+
69+
## What Stays Identical
70+
- Rubric schema and criteria content
71+
- Finding JSON schema (FINDINGS_SCHEMA)
72+
- Pre-screen check IDs (PS-001 through PS-010)
73+
- Verdict taxonomy (PASS / PASS_WITH_NOTES / REVISE / REJECT)
74+
- Severity levels (CRITICAL / HIGH / MEDIUM / LOW / INFO)
75+
- Evidence grounding requirement
76+
- Critic system prompts (verbatim)
77+
78+
## What Is NOT Included in This Port
79+
- **Tester (Phase 3)** — verification requires filesystem access patterns that differ in Copilot
80+
- **Fix loops** — Copilot's edit model differs from file-write patterns
81+
- **Learning memory** — future enhancement
82+
- **Batch mode** — Copilot invocations are per-file
83+
84+
## References
85+
- [Reference Implementation](../../reference-implementation/)
86+
- [Architecture Mapping](ARCHITECTURE.md)

0 commit comments

Comments
 (0)