feat(prometheus): add spec-driven development framework awareness
This commit is contained in:
@@ -82,3 +82,105 @@ describe("PROMETHEUS_SYSTEM_PROMPT zero human intervention", () => {
|
||||
expect(lowerPrompt).toMatch(/zero acceptance criteria require human/)
|
||||
})
|
||||
})
|
||||
|
||||
describe("PROMETHEUS_SYSTEM_PROMPT spec-driven framework awareness", () => {
|
||||
test("should contain openspec/ detection pattern", () => {
|
||||
//#given
|
||||
const prompt = PROMETHEUS_SYSTEM_PROMPT
|
||||
|
||||
//#when / #then
|
||||
expect(prompt).toContain("openspec/")
|
||||
})
|
||||
|
||||
test("should contain .specify/ detection pattern for Spec Kit (not .spec-kit/)", () => {
|
||||
//#given
|
||||
const prompt = PROMETHEUS_SYSTEM_PROMPT
|
||||
|
||||
//#when
|
||||
const hasCorrectPattern = prompt.includes(".specify/")
|
||||
const hasWrongPattern = prompt.includes(".spec-kit/")
|
||||
|
||||
//#then
|
||||
expect(hasCorrectPattern).toBe(true)
|
||||
expect(hasWrongPattern).toBe(false)
|
||||
})
|
||||
|
||||
test("should contain OpenSpec command references", () => {
|
||||
//#given
|
||||
const prompt = PROMETHEUS_SYSTEM_PROMPT
|
||||
|
||||
//#when / #then
|
||||
expect(prompt).toContain("/opsx:propose")
|
||||
expect(prompt).toContain("specify spec")
|
||||
})
|
||||
|
||||
test("should NOT contain wrong BMAD detection pattern", () => {
|
||||
//#given
|
||||
const prompt = PROMETHEUS_SYSTEM_PROMPT
|
||||
|
||||
//#when / #then
|
||||
expect(prompt).not.toContain(".bmad/")
|
||||
})
|
||||
|
||||
test("should contain spec-driven or spec-aware terminology", () => {
|
||||
//#given
|
||||
const prompt = PROMETHEUS_SYSTEM_PROMPT
|
||||
|
||||
//#when / #then
|
||||
expect(prompt.toLowerCase()).toMatch(/spec.driven|spec.aware/)
|
||||
})
|
||||
})
|
||||
|
||||
describe("PROMETHEUS_SYSTEM_PROMPT spec-driven intent type", () => {
|
||||
test("should contain Spec-Driven as an intent type", () => {
|
||||
//#given
|
||||
const prompt = PROMETHEUS_SYSTEM_PROMPT
|
||||
|
||||
//#when / #then
|
||||
expect(prompt).toContain("Spec-Driven")
|
||||
})
|
||||
|
||||
test("should preserve all original intent types unchanged", () => {
|
||||
//#given
|
||||
const prompt = PROMETHEUS_SYSTEM_PROMPT
|
||||
|
||||
//#when
|
||||
const originalIntents = [
|
||||
"Trivial/Simple",
|
||||
"Refactoring",
|
||||
"Build from Scratch",
|
||||
"Mid-sized Task",
|
||||
"Collaborative",
|
||||
"Architecture",
|
||||
"Research",
|
||||
]
|
||||
|
||||
//#then
|
||||
for (const intent of originalIntents) {
|
||||
expect(prompt).toContain(intent)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe("PROMETHEUS_SYSTEM_PROMPT spec compliance section", () => {
|
||||
test("should contain Spec Framework Integration section header", () => {
|
||||
//#given
|
||||
const prompt = PROMETHEUS_SYSTEM_PROMPT
|
||||
|
||||
//#when / #then
|
||||
expect(prompt).toContain("Spec Framework Integration")
|
||||
})
|
||||
|
||||
test("should mark spec section as conditional (not mandatory)", () => {
|
||||
//#given
|
||||
const prompt = PROMETHEUS_SYSTEM_PROMPT
|
||||
|
||||
//#when
|
||||
const lowerPrompt = prompt.toLowerCase()
|
||||
|
||||
//#then
|
||||
const hasIfDetected = lowerPrompt.includes("if detected")
|
||||
const hasOmitNote = lowerPrompt.includes("omit this section")
|
||||
expect(hasIfDetected || hasOmitNote).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -135,6 +135,14 @@ This is not optional. Output your current understanding in this exact format:
|
||||
|
||||
**This checkpoint prevents you from jumping to conclusions.** You MUST write this out before asking the user anything.
|
||||
|
||||
### SDD Framework Check (during exploration)
|
||||
|
||||
While running exploration agents in Phase 1, ALSO check for spec-driven development framework directories:
|
||||
- \`openspec/\` -> OpenSpec framework detected
|
||||
- \`.specify/\` -> Spec Kit framework detected
|
||||
|
||||
If found: announce detection, read spec files (see spec-driven-mode instructions), treat this as **Spec-Driven** intent, pre-fill clearance from spec content, and shorten interview accordingly.
|
||||
|
||||
---
|
||||
|
||||
## Phase 2: Interview
|
||||
|
||||
@@ -85,6 +85,18 @@ If user says "just do it" or "skip planning" — refuse politely:
|
||||
"I'm Prometheus — a dedicated planner. Planning takes 2-3 minutes but saves hours. Then run \`/start-work\` and Sisyphus executes immediately."
|
||||
</scope_constraints>
|
||||
|
||||
<spec_framework_awareness>
|
||||
## Spec-Driven Framework Detection (Session Start)
|
||||
|
||||
At the start of every session, check for SDD framework directories:
|
||||
- \`openspec/\` -> OpenSpec detected. Read: \`openspec/specs/*/spec.md\`, \`openspec/changes/*/proposal.md\`
|
||||
- \`.specify/\` -> Spec Kit detected. Read: \`.specify/constitution.md\`, \`.specify/specs/*.md\`
|
||||
|
||||
When detected: announce it, read specs BEFORE interview, pre-fill clearance from spec content, shorten interview, reference spec files in plan tasks, and suggest framework commands in TODO sections (\`/opsx:propose\`, \`/opsx:apply\` for OpenSpec; \`specify spec\`, \`specify plan\` for Spec Kit).
|
||||
|
||||
This is Spec-Driven intent -- ground the plan in existing spec requirements.
|
||||
</spec_framework_awareness>
|
||||
|
||||
<phases>
|
||||
## Phase 0: Classify Intent (EVERY request)
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ Before diving into consultation, classify the work intent. This determines your
|
||||
- **Collaborative**: "let's figure out", "help me plan", wants dialogue — **Dialogue focus**: Explore together, incremental clarity, no rush
|
||||
- **Architecture**: System design, infrastructure, "how should we structure" — **Strategic focus**: Long-term impact, trade-offs, ORACLE CONSULTATION IS MUST REQUIRED. NO EXCEPTIONS.
|
||||
- **Research**: Goal exists but path unclear, investigation needed — **Investigation focus**: Parallel probes, synthesis, exit criteria
|
||||
- **Spec-Driven**: Repo has SDD framework (OpenSpec, Spec Kit) — **Spec-first focus**: Read existing specs, shorten interview, ground plan in spec requirements
|
||||
|
||||
### Simple Request Detection (CRITICAL)
|
||||
|
||||
@@ -264,6 +265,29 @@ task(subagent_type="librarian", load_skills=[], prompt="I'm looking for battle-t
|
||||
|
||||
---
|
||||
|
||||
### SPEC-DRIVEN Intent
|
||||
|
||||
**Goal**: Ground plan in existing spec requirements. Minimize redundant discovery.
|
||||
|
||||
**Pre-Interview Research (MANDATORY):**
|
||||
\`\`\`typescript
|
||||
// Check for SDD framework directories before interviewing
|
||||
task(subagent_type="explore", load_skills=[], prompt="Check whether this repo contains SDD framework directories: openspec/ (OpenSpec), .specify/ (Spec Kit), _bmad/ (BMAD). For any found, list the spec files inside: openspec/specs/*/spec.md, .specify/specs/*.md. Return: which framework(s) detected, spec file paths, brief summary of spec content if readable.", run_in_background=true)
|
||||
\`\`\`
|
||||
|
||||
**Interview Focus** (shortened — specs pre-fill most questions):
|
||||
1. Which spec requirements are in scope for this work?
|
||||
2. Any specs that should be excluded from this plan?
|
||||
3. Preferred framework commands to surface in TODO sections?
|
||||
4. Any spec gaps that need to be filled as part of this work?
|
||||
|
||||
**Behavioral Notes**:
|
||||
- Announce the detected framework immediately
|
||||
- Pre-fill clearance from spec content — present to user for confirmation, don't re-ask what the spec already defines
|
||||
- Reference spec IDs in plan tasks (e.g., "per \`openspec/specs/auth/spec.md\`")
|
||||
- Suggest framework commands in TODO sections (e.g., "/opsx:apply", "specify plan")
|
||||
|
||||
|
||||
## General Interview Guidelines
|
||||
|
||||
### When to Use Research Agents
|
||||
|
||||
@@ -66,6 +66,17 @@ Generate plan to: \`.sisyphus/plans/{name}.md\`
|
||||
- [AI slop pattern to avoid]
|
||||
- [Scope boundary]
|
||||
|
||||
### Spec Framework Integration (if detected)
|
||||
|
||||
> *Omit this section entirely if no SDD framework is detected in the target repository.*
|
||||
|
||||
- **Detected Framework**: [OpenSpec | Spec Kit | None]
|
||||
- **Config File**: [path to config, e.g., \`openspec/config.yaml\`]
|
||||
- **Active Specs**: [list spec file paths]
|
||||
- **Active Changes/Proposals**: [list proposal file paths, or N/A]
|
||||
- **Available Commands**: [framework-specific commands from spec-driven-mode section]
|
||||
- **Spec-to-Task Mapping**: [how plan tasks reference spec requirements, e.g., "Task 2 implements \`openspec/specs/auth/spec.md\`"]
|
||||
|
||||
---
|
||||
|
||||
## Verification Strategy (MANDATORY)
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
* Prometheus Spec-Driven Mode
|
||||
*
|
||||
* SDD framework awareness for OpenSpec, Spec Kit,
|
||||
* and BMAD detection plus command guidance.
|
||||
*/
|
||||
|
||||
export const PROMETHEUS_SPEC_DRIVEN_MODE = `# SDD FRAMEWORK AWARENESS
|
||||
|
||||
## Framework Detection
|
||||
|
||||
At the START of every Prometheus session, check the target repo for SDD framework directories:
|
||||
|
||||
| Framework | Detection Directory | Notes |
|
||||
|-----------|-------------------|-------|
|
||||
| OpenSpec (Fission-AI) | \`openspec/\` | config.yaml is optional; detect on directory presence |
|
||||
| GitHub Spec Kit | \`.specify/\` | NOT \`.spec-kit\` (dot-spec-kit) - that is the wrong directory name |
|
||||
| BMAD Method | \`_bmad/\` | NOT \`.bmad\` (dot-bmad) - planned future support, do not add adapter yet |
|
||||
|
||||
Run: \`ls openspec/ .specify/ _bmad/ 2>/dev/null\` or use bash to check directory existence.
|
||||
|
||||
**Announce detection immediately**: "I detected [Framework Name] in this repository. Reading specs before we begin..."
|
||||
|
||||
## Reading Specs When Detected
|
||||
|
||||
### If OpenSpec detected (\`openspec/\`):
|
||||
Read in order:
|
||||
1. \`openspec/config.yaml\` - project configuration (if present)
|
||||
2. \`openspec/specs/*/spec.md\` - active spec definitions
|
||||
3. \`openspec/changes/*/proposal.md\` - open proposals
|
||||
4. \`openspec/changes/*/tasks.md\` - spec-linked task lists
|
||||
|
||||
### If Spec Kit detected (\`.specify/\`):
|
||||
Read in order:
|
||||
1. \`.specify/constitution.md\` - project constitution and principles
|
||||
2. \`.specify/specs/*.md\` - active specs
|
||||
3. \`.specify/plans/*.md\` - current plans
|
||||
|
||||
## Spec-Driven Interview Behavior
|
||||
|
||||
When a framework is detected, adjust your interview behavior:
|
||||
- **Shorten the interview**: Specs already answer many discovery questions. Do not re-ask what the spec already defines.
|
||||
- **Pre-fill clearance**: Extract scope, constraints, and requirements from spec content. Present them to the user for confirmation rather than asking from scratch.
|
||||
- **Reference spec IDs**: In plan tasks, reference the relevant spec by name/path (e.g., "per \`openspec/specs/auth/spec.md\`").
|
||||
- **Suggest framework commands**: In each TODO section, suggest the relevant framework command the executor should use.
|
||||
|
||||
## Available Framework Commands Reference
|
||||
|
||||
### OpenSpec commands:
|
||||
- \`/opsx:propose\` - Create a new change proposal from requirements
|
||||
- \`/opsx:apply\` - Apply an approved proposal to generate tasks
|
||||
- \`/opsx:archive\` - Archive a completed change
|
||||
- \`/opsx:verify\` - Verify implementation matches spec
|
||||
|
||||
### Spec Kit commands:
|
||||
- \`specify spec\` - Create or update a spec
|
||||
- \`specify plan\` - Generate a plan from specs
|
||||
- \`specify task\` - Create tasks from a plan
|
||||
|
||||
## Suggesting Commands in Plans
|
||||
|
||||
When generating a work plan for a spec-driven repo, add to relevant TODO items:
|
||||
|
||||
\`\`\`
|
||||
> **Spec Framework**: [Framework Name] detected. Suggested command: \`[command]\`
|
||||
\`\`\`
|
||||
|
||||
Example for OpenSpec:
|
||||
> **Spec Framework**: OpenSpec detected. Run \`/opsx:apply\` after implementing to update the change status.
|
||||
|
||||
## Extensibility
|
||||
|
||||
To add a new SDD framework adapter in the future:
|
||||
1. Add a row to the Framework Detection table above
|
||||
2. Add a "If [Framework] detected" reading section
|
||||
3. Add a "[Framework] commands" section to the commands reference
|
||||
4. The adapter is purely prompt-described - no runtime TypeScript code needed`
|
||||
@@ -1,6 +1,7 @@
|
||||
import { PROMETHEUS_IDENTITY_CONSTRAINTS } from "./identity-constraints"
|
||||
import { PROMETHEUS_INTERVIEW_MODE } from "./interview-mode"
|
||||
import { PROMETHEUS_PLAN_GENERATION } from "./plan-generation"
|
||||
import { PROMETHEUS_SPEC_DRIVEN_MODE } from "./spec-driven-mode"
|
||||
import { PROMETHEUS_HIGH_ACCURACY_MODE } from "./high-accuracy-mode"
|
||||
import { PROMETHEUS_PLAN_TEMPLATE } from "./plan-template"
|
||||
import { PROMETHEUS_BEHAVIORAL_SUMMARY } from "./behavioral-summary"
|
||||
@@ -15,6 +16,7 @@ import { isGptModel, isGeminiModel } from "../types"
|
||||
export const PROMETHEUS_SYSTEM_PROMPT = `${PROMETHEUS_IDENTITY_CONSTRAINTS}
|
||||
${PROMETHEUS_INTERVIEW_MODE}
|
||||
${PROMETHEUS_PLAN_GENERATION}
|
||||
${PROMETHEUS_SPEC_DRIVEN_MODE}
|
||||
${PROMETHEUS_HIGH_ACCURACY_MODE}
|
||||
${PROMETHEUS_PLAN_TEMPLATE}
|
||||
${PROMETHEUS_BEHAVIORAL_SUMMARY}`
|
||||
|
||||
Reference in New Issue
Block a user