chore(config): add PRD.md and .claude/ project config to repository
- PRD.md: Product Requirements Document (single source of truth for all requirements) - .claude/settings.local.json: Claude Code agent permission config - .claude/commands/: project-specific slash commands - .claude/skills/: project-specific skill definitions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
198
.claude/commands/continue.md
Normal file
198
.claude/commands/continue.md
Normal file
@@ -0,0 +1,198 @@
|
||||
---
|
||||
name: "Continue"
|
||||
description: Capture a full project status snapshot so the next session can continue seamlessly from where this one left off
|
||||
category: Workflow
|
||||
tags: [workflow, session, continuity, memory, snapshot]
|
||||
---
|
||||
|
||||
Capture the full current project status and store it in persistent memory so the next session can pick up exactly where this one left off — no context lost, no recap needed.
|
||||
|
||||
**Input**: No arguments required. Run `/continue` at any point when ending a session.
|
||||
|
||||
---
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **Capture git state**
|
||||
|
||||
Run the following in parallel:
|
||||
```bash
|
||||
git status
|
||||
git branch --show-current
|
||||
git log --oneline -10
|
||||
git diff --stat HEAD
|
||||
git stash list
|
||||
```
|
||||
|
||||
Record:
|
||||
- Current branch name
|
||||
- Uncommitted files (staged and unstaged), with change type (M/A/D/?)
|
||||
- Last 10 commit messages (for continuity context)
|
||||
- Summary of diff stats if uncommitted changes exist
|
||||
- Any stashed work
|
||||
|
||||
2. **Capture OpenSpec change state**
|
||||
|
||||
Run `openspec list --json` to get all active changes.
|
||||
|
||||
For each active (non-archived) change, run:
|
||||
```bash
|
||||
openspec status --change "<name>" --json
|
||||
```
|
||||
|
||||
For each active change, also read its `tasks.md` to count:
|
||||
- Total tasks
|
||||
- Completed tasks (`- [x]`)
|
||||
- Pending tasks (`- [ ]`)
|
||||
- The text of the next pending task (to know what's up next)
|
||||
|
||||
Record per change:
|
||||
- Change name
|
||||
- Schema
|
||||
- Artifact completion (which are done, which are pending)
|
||||
- Task progress (X of Y complete)
|
||||
- Next pending task description
|
||||
- Any delta specs present (`openspec/changes/<name>/specs/`)
|
||||
|
||||
**If no active changes:** Note that there are no active OpenSpec changes.
|
||||
|
||||
3. **Capture in-session conversation context**
|
||||
|
||||
Summarize what was worked on in this session based on the conversation:
|
||||
- What was the user trying to accomplish?
|
||||
- What was completed?
|
||||
- What was left in-progress or blocked?
|
||||
- Any key decisions made during this session
|
||||
- Any open questions or next actions the user mentioned
|
||||
|
||||
Keep this factual and brief — 3–8 bullet points.
|
||||
|
||||
4. **Capture memory file state**
|
||||
|
||||
Read `MEMORY.md` from the project memory directory:
|
||||
`~/.claude/projects/-home-ubuntu-vj-ai-agents-dev-sentryagent-idp/memory/MEMORY.md`
|
||||
|
||||
Note the existing memory entries to avoid duplication in the next step.
|
||||
|
||||
5. **Write session snapshot to memory**
|
||||
|
||||
Write a `session_snapshot.md` file to the project memory directory:
|
||||
`~/.claude/projects/-home-ubuntu-vj-ai-agents-dev-sentryagent-idp/memory/session_snapshot.md`
|
||||
|
||||
Use this structure:
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: Session Snapshot
|
||||
description: Last session status — git state, OpenSpec progress, and conversation context for seamless resumption
|
||||
type: project
|
||||
---
|
||||
|
||||
**Session ended:** YYYY-MM-DD (today's date)
|
||||
|
||||
## Git State
|
||||
|
||||
**Branch:** <branch-name>
|
||||
**Uncommitted changes:** <count> files (<list filenames>)
|
||||
**Last commit:** <hash> <message>
|
||||
|
||||
<If uncommitted changes exist, list them with their status>
|
||||
|
||||
<If stashes exist, list them>
|
||||
|
||||
## OpenSpec Changes
|
||||
|
||||
<For each active change:>
|
||||
### <change-name>
|
||||
- **Schema:** <schema-name>
|
||||
- **Artifacts:** <done-count>/<total-count> complete (<list incomplete artifact names>)
|
||||
- **Tasks:** <done-count>/<total-count> complete
|
||||
- **Next task:** <text of next pending task>
|
||||
- **Delta specs:** <present / none>
|
||||
|
||||
<If no active changes:> No active OpenSpec changes.
|
||||
|
||||
## Session Work
|
||||
|
||||
<Bullet list of what was worked on, completed, and left in-progress>
|
||||
|
||||
## Next Actions
|
||||
|
||||
<Bullet list of concrete next steps to resume — derived from pending tasks, blockers, open questions>
|
||||
```
|
||||
|
||||
**IMPORTANT:** Always overwrite `session_snapshot.md` — this is a rolling snapshot, not a log. Only the most recent session state matters.
|
||||
|
||||
6. **Update MEMORY.md index**
|
||||
|
||||
Read the current `MEMORY.md`. If `session_snapshot.md` is not already listed, add it:
|
||||
```
|
||||
- [Session Snapshot](session_snapshot.md) — Last session: YYYY-MM-DD | branch: <name> | <N> active changes | <N> uncommitted files
|
||||
```
|
||||
|
||||
If it is already listed, update the line to reflect today's date and current state.
|
||||
|
||||
Write the updated `MEMORY.md`.
|
||||
|
||||
7. **Display break summary**
|
||||
|
||||
Show a clean summary so the user knows the snapshot is complete:
|
||||
|
||||
```
|
||||
## Snapshot Saved — See You Next Session
|
||||
|
||||
**Branch:** <branch-name>
|
||||
**Uncommitted files:** <count> (<filenames>)
|
||||
**Active changes:** <count>
|
||||
|
||||
<For each active change:>
|
||||
- <change-name>: <done>/<total> tasks complete — Next: "<next task text>"
|
||||
|
||||
**Session context saved to memory.**
|
||||
|
||||
To resume: start a new session and run /continue — Claude will load the snapshot and pick up where you left off.
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Output On Success (with active changes)**
|
||||
|
||||
```
|
||||
## Snapshot Saved — See You Next Session
|
||||
|
||||
**Branch:** develop
|
||||
**Uncommitted files:** 3 (src/auth/token.ts, tests/auth.test.ts, README.md)
|
||||
**Active changes:** 1
|
||||
|
||||
- add-agent-auth: 4/7 tasks complete — Next: "Implement JWT signing with RS256"
|
||||
|
||||
**Session context saved to memory.**
|
||||
|
||||
To resume: start a new session and run /continue — Claude will load the snapshot and pick up where you left off.
|
||||
```
|
||||
|
||||
**Output On Success (clean state)**
|
||||
|
||||
```
|
||||
## Snapshot Saved — See You Next Session
|
||||
|
||||
**Branch:** main
|
||||
**Uncommitted files:** 0
|
||||
**Active changes:** 0
|
||||
|
||||
**Session context saved to memory.**
|
||||
|
||||
To resume: start a new session and run /continue — Claude will load the snapshot and pick up where you left off.
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Guardrails**
|
||||
|
||||
- Always overwrite `session_snapshot.md` — do NOT append or create versioned copies
|
||||
- Never include secrets, tokens, or credentials in the snapshot
|
||||
- If `openspec list` fails (CLI not available), note that and skip OpenSpec capture gracefully
|
||||
- If git is unavailable, note that and skip git capture gracefully
|
||||
- Keep the session context summary factual — no speculation about future plans beyond what the user explicitly stated
|
||||
- The MEMORY.md index line for `session_snapshot.md` must stay under 150 characters
|
||||
- This command does NOT commit code, push branches, or modify any project files — it only writes to the memory directory
|
||||
160
.claude/commands/openspec-project-status.md
Normal file
160
.claude/commands/openspec-project-status.md
Normal file
@@ -0,0 +1,160 @@
|
||||
---
|
||||
name: "OpenSpec Project Status"
|
||||
description: Show a human-readable summary of all OpenSpec changes — active, archived, artifact completion, and task progress
|
||||
category: Workflow
|
||||
tags: [workflow, status, openspec, reporting]
|
||||
---
|
||||
|
||||
Show the full OpenSpec project status in a clear, human-readable format. No raw JSON — just a clean picture of where the project stands.
|
||||
|
||||
**Input**: No arguments required. Run `/openspec-project-status` at any time.
|
||||
|
||||
---
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **Get all changes**
|
||||
|
||||
Run:
|
||||
```bash
|
||||
openspec list --json
|
||||
```
|
||||
|
||||
Separate results into:
|
||||
- **Active changes** (not in `archive/`)
|
||||
- **Archived changes** (in `archive/`)
|
||||
|
||||
If the command fails or no changes exist, display a friendly empty state (see Output section).
|
||||
|
||||
2. **For each active change, gather full status**
|
||||
|
||||
Run in parallel for all active changes:
|
||||
```bash
|
||||
openspec status --change "<name>" --json
|
||||
```
|
||||
|
||||
Also read each change's `tasks.md` to extract:
|
||||
- Total task count
|
||||
- Completed tasks (`- [x]`)
|
||||
- Pending tasks (`- [ ]`)
|
||||
- Text of the **next pending task** (first `- [ ]` item)
|
||||
|
||||
Also check for delta specs at `openspec/changes/<name>/specs/` — note if present.
|
||||
|
||||
3. **For archived changes**
|
||||
|
||||
List them by archive date (newest first). No need to read full status — just show name and archive date from the folder name (`YYYY-MM-DD-<name>`).
|
||||
|
||||
4. **Render the human-readable status report**
|
||||
|
||||
Use the output format defined below.
|
||||
|
||||
---
|
||||
|
||||
**Output Format**
|
||||
|
||||
```
|
||||
## OpenSpec Project Status
|
||||
|
||||
### Active Changes (<count>)
|
||||
|
||||
────────────────────────────────────────
|
||||
<change-name>
|
||||
────────────────────────────────────────
|
||||
Schema: <schema-name>
|
||||
Phase: <inferred from artifact state: Proposing | Designing | Ready to Implement | In Progress | Complete>
|
||||
|
||||
Artifacts
|
||||
✓ proposal done
|
||||
✓ design done
|
||||
◌ tasks pending
|
||||
|
||||
Tasks <done>/<total> complete
|
||||
████████░░░░░░░░ 50%
|
||||
Next: "<text of next pending task>"
|
||||
|
||||
Delta Specs <present / none>
|
||||
|
||||
────────────────────────────────────────
|
||||
|
||||
<Repeat for each active change>
|
||||
|
||||
---
|
||||
|
||||
### Archived Changes (<count>)
|
||||
|
||||
2026-03-20 add-initial-auth
|
||||
2026-03-15 setup-ci-pipeline
|
||||
2026-03-10 scaffold-project
|
||||
|
||||
---
|
||||
|
||||
### Summary
|
||||
|
||||
Active changes: <N>
|
||||
Ready to apply: <N> (all artifacts done, tasks pending)
|
||||
In progress: <N> (tasks partially complete)
|
||||
Complete: <N> (all tasks done, not yet archived)
|
||||
Archived: <N>
|
||||
```
|
||||
|
||||
**Phase inference rules** (from artifact + task state):
|
||||
- `Proposing` — proposal artifact is not done
|
||||
- `Designing` — proposal done, design not done
|
||||
- `Speccing` — design done, tasks artifact not done
|
||||
- `Ready to Implement` — all artifacts done, 0 tasks complete
|
||||
- `In Progress` — all artifacts done, some tasks complete but not all
|
||||
- `Complete` — all artifacts done, all tasks complete (not yet archived)
|
||||
|
||||
**Progress bar rules:**
|
||||
- 16 chars wide: `█` per completed segment, `░` for remaining
|
||||
- Show percentage after bar
|
||||
- If 0 tasks: show `No tasks yet`
|
||||
- If all tasks done: show `████████████████ 100% All done!`
|
||||
|
||||
---
|
||||
|
||||
**Output: No active changes**
|
||||
|
||||
```
|
||||
## OpenSpec Project Status
|
||||
|
||||
### Active Changes (0)
|
||||
|
||||
No active changes. Start one with /opsx:propose
|
||||
|
||||
---
|
||||
|
||||
### Archived Changes (<count>)
|
||||
|
||||
2026-03-20 add-initial-auth
|
||||
...
|
||||
|
||||
---
|
||||
|
||||
### Summary
|
||||
|
||||
Active changes: 0
|
||||
Archived: <N>
|
||||
```
|
||||
|
||||
**Output: OpenSpec CLI unavailable**
|
||||
|
||||
```
|
||||
## OpenSpec Project Status
|
||||
|
||||
OpenSpec CLI not available. Cannot read change data.
|
||||
|
||||
Make sure `openspec` is installed and accessible in your PATH.
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Guardrails**
|
||||
|
||||
- Never show raw JSON — always translate to human-readable output
|
||||
- Never guess artifact or task state — always read from actual files and CLI output
|
||||
- If a `tasks.md` file does not exist for a change, show `No tasks file` instead of 0/0
|
||||
- Archived changes are display-only — never modify them
|
||||
- Phase labels must be inferred strictly from actual artifact + task state, not assumed
|
||||
- If `openspec status` fails for a specific change, show that change with `Status unavailable` and continue
|
||||
152
.claude/commands/opsx/apply.md
Normal file
152
.claude/commands/opsx/apply.md
Normal file
@@ -0,0 +1,152 @@
|
||||
---
|
||||
name: "OPSX: Apply"
|
||||
description: Implement tasks from an OpenSpec change (Experimental)
|
||||
category: Workflow
|
||||
tags: [workflow, artifacts, experimental]
|
||||
---
|
||||
|
||||
Implement tasks from an OpenSpec change.
|
||||
|
||||
**Input**: Optionally specify a change name (e.g., `/opsx:apply add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **Select the change**
|
||||
|
||||
If a name is provided, use it. Otherwise:
|
||||
- Infer from conversation context if the user mentioned a change
|
||||
- Auto-select if only one active change exists
|
||||
- If ambiguous, run `openspec list --json` to get available changes and use the **AskUserQuestion tool** to let the user select
|
||||
|
||||
Always announce: "Using change: <name>" and how to override (e.g., `/opsx:apply <other>`).
|
||||
|
||||
2. **Check status to understand the schema**
|
||||
```bash
|
||||
openspec status --change "<name>" --json
|
||||
```
|
||||
Parse the JSON to understand:
|
||||
- `schemaName`: The workflow being used (e.g., "spec-driven")
|
||||
- Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
|
||||
|
||||
3. **Get apply instructions**
|
||||
|
||||
```bash
|
||||
openspec instructions apply --change "<name>" --json
|
||||
```
|
||||
|
||||
This returns:
|
||||
- Context file paths (varies by schema)
|
||||
- Progress (total, complete, remaining)
|
||||
- Task list with status
|
||||
- Dynamic instruction based on current state
|
||||
|
||||
**Handle states:**
|
||||
- If `state: "blocked"` (missing artifacts): show message, suggest using `/opsx:continue`
|
||||
- If `state: "all_done"`: congratulate, suggest archive
|
||||
- Otherwise: proceed to implementation
|
||||
|
||||
4. **Read context files**
|
||||
|
||||
Read the files listed in `contextFiles` from the apply instructions output.
|
||||
The files depend on the schema being used:
|
||||
- **spec-driven**: proposal, specs, design, tasks
|
||||
- Other schemas: follow the contextFiles from CLI output
|
||||
|
||||
5. **Show current progress**
|
||||
|
||||
Display:
|
||||
- Schema being used
|
||||
- Progress: "N/M tasks complete"
|
||||
- Remaining tasks overview
|
||||
- Dynamic instruction from CLI
|
||||
|
||||
6. **Implement tasks (loop until done or blocked)**
|
||||
|
||||
For each pending task:
|
||||
- Show which task is being worked on
|
||||
- Make the code changes required
|
||||
- Keep changes minimal and focused
|
||||
- Mark task complete in the tasks file: `- [ ]` → `- [x]`
|
||||
- Continue to next task
|
||||
|
||||
**Pause if:**
|
||||
- Task is unclear → ask for clarification
|
||||
- Implementation reveals a design issue → suggest updating artifacts
|
||||
- Error or blocker encountered → report and wait for guidance
|
||||
- User interrupts
|
||||
|
||||
7. **On completion or pause, show status**
|
||||
|
||||
Display:
|
||||
- Tasks completed this session
|
||||
- Overall progress: "N/M tasks complete"
|
||||
- If all done: suggest archive
|
||||
- If paused: explain why and wait for guidance
|
||||
|
||||
**Output During Implementation**
|
||||
|
||||
```
|
||||
## Implementing: <change-name> (schema: <schema-name>)
|
||||
|
||||
Working on task 3/7: <task description>
|
||||
[...implementation happening...]
|
||||
✓ Task complete
|
||||
|
||||
Working on task 4/7: <task description>
|
||||
[...implementation happening...]
|
||||
✓ Task complete
|
||||
```
|
||||
|
||||
**Output On Completion**
|
||||
|
||||
```
|
||||
## Implementation Complete
|
||||
|
||||
**Change:** <change-name>
|
||||
**Schema:** <schema-name>
|
||||
**Progress:** 7/7 tasks complete ✓
|
||||
|
||||
### Completed This Session
|
||||
- [x] Task 1
|
||||
- [x] Task 2
|
||||
...
|
||||
|
||||
All tasks complete! You can archive this change with `/opsx:archive`.
|
||||
```
|
||||
|
||||
**Output On Pause (Issue Encountered)**
|
||||
|
||||
```
|
||||
## Implementation Paused
|
||||
|
||||
**Change:** <change-name>
|
||||
**Schema:** <schema-name>
|
||||
**Progress:** 4/7 tasks complete
|
||||
|
||||
### Issue Encountered
|
||||
<description of the issue>
|
||||
|
||||
**Options:**
|
||||
1. <option 1>
|
||||
2. <option 2>
|
||||
3. Other approach
|
||||
|
||||
What would you like to do?
|
||||
```
|
||||
|
||||
**Guardrails**
|
||||
- Keep going through tasks until done or blocked
|
||||
- Always read context files before starting (from the apply instructions output)
|
||||
- If task is ambiguous, pause and ask before implementing
|
||||
- If implementation reveals issues, pause and suggest artifact updates
|
||||
- Keep code changes minimal and scoped to each task
|
||||
- Update task checkbox immediately after completing each task
|
||||
- Pause on errors, blockers, or unclear requirements - don't guess
|
||||
- Use contextFiles from CLI output, don't assume specific file names
|
||||
|
||||
**Fluid Workflow Integration**
|
||||
|
||||
This skill supports the "actions on a change" model:
|
||||
|
||||
- **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
|
||||
- **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly
|
||||
157
.claude/commands/opsx/archive.md
Normal file
157
.claude/commands/opsx/archive.md
Normal file
@@ -0,0 +1,157 @@
|
||||
---
|
||||
name: "OPSX: Archive"
|
||||
description: Archive a completed change in the experimental workflow
|
||||
category: Workflow
|
||||
tags: [workflow, archive, experimental]
|
||||
---
|
||||
|
||||
Archive a completed change in the experimental workflow.
|
||||
|
||||
**Input**: Optionally specify a change name after `/opsx:archive` (e.g., `/opsx:archive add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **If no change name provided, prompt for selection**
|
||||
|
||||
Run `openspec list --json` to get available changes. Use the **AskUserQuestion tool** to let the user select.
|
||||
|
||||
Show only active changes (not already archived).
|
||||
Include the schema used for each change if available.
|
||||
|
||||
**IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
|
||||
|
||||
2. **Check artifact completion status**
|
||||
|
||||
Run `openspec status --change "<name>" --json` to check artifact completion.
|
||||
|
||||
Parse the JSON to understand:
|
||||
- `schemaName`: The workflow being used
|
||||
- `artifacts`: List of artifacts with their status (`done` or other)
|
||||
|
||||
**If any artifacts are not `done`:**
|
||||
- Display warning listing incomplete artifacts
|
||||
- Prompt user for confirmation to continue
|
||||
- Proceed if user confirms
|
||||
|
||||
3. **Check task completion status**
|
||||
|
||||
Read the tasks file (typically `tasks.md`) to check for incomplete tasks.
|
||||
|
||||
Count tasks marked with `- [ ]` (incomplete) vs `- [x]` (complete).
|
||||
|
||||
**If incomplete tasks found:**
|
||||
- Display warning showing count of incomplete tasks
|
||||
- Prompt user for confirmation to continue
|
||||
- Proceed if user confirms
|
||||
|
||||
**If no tasks file exists:** Proceed without task-related warning.
|
||||
|
||||
4. **Assess delta spec sync state**
|
||||
|
||||
Check for delta specs at `openspec/changes/<name>/specs/`. If none exist, proceed without sync prompt.
|
||||
|
||||
**If delta specs exist:**
|
||||
- Compare each delta spec with its corresponding main spec at `openspec/specs/<capability>/spec.md`
|
||||
- Determine what changes would be applied (adds, modifications, removals, renames)
|
||||
- Show a combined summary before prompting
|
||||
|
||||
**Prompt options:**
|
||||
- If changes needed: "Sync now (recommended)", "Archive without syncing"
|
||||
- If already synced: "Archive now", "Sync anyway", "Cancel"
|
||||
|
||||
If user chooses sync, use Task tool (subagent_type: "general-purpose", prompt: "Use Skill tool to invoke openspec-sync-specs for change '<name>'. Delta spec analysis: <include the analyzed delta spec summary>"). Proceed to archive regardless of choice.
|
||||
|
||||
5. **Perform the archive**
|
||||
|
||||
Create the archive directory if it doesn't exist:
|
||||
```bash
|
||||
mkdir -p openspec/changes/archive
|
||||
```
|
||||
|
||||
Generate target name using current date: `YYYY-MM-DD-<change-name>`
|
||||
|
||||
**Check if target already exists:**
|
||||
- If yes: Fail with error, suggest renaming existing archive or using different date
|
||||
- If no: Move the change directory to archive
|
||||
|
||||
```bash
|
||||
mv openspec/changes/<name> openspec/changes/archive/YYYY-MM-DD-<name>
|
||||
```
|
||||
|
||||
6. **Display summary**
|
||||
|
||||
Show archive completion summary including:
|
||||
- Change name
|
||||
- Schema that was used
|
||||
- Archive location
|
||||
- Spec sync status (synced / sync skipped / no delta specs)
|
||||
- Note about any warnings (incomplete artifacts/tasks)
|
||||
|
||||
**Output On Success**
|
||||
|
||||
```
|
||||
## Archive Complete
|
||||
|
||||
**Change:** <change-name>
|
||||
**Schema:** <schema-name>
|
||||
**Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/
|
||||
**Specs:** ✓ Synced to main specs
|
||||
|
||||
All artifacts complete. All tasks complete.
|
||||
```
|
||||
|
||||
**Output On Success (No Delta Specs)**
|
||||
|
||||
```
|
||||
## Archive Complete
|
||||
|
||||
**Change:** <change-name>
|
||||
**Schema:** <schema-name>
|
||||
**Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/
|
||||
**Specs:** No delta specs
|
||||
|
||||
All artifacts complete. All tasks complete.
|
||||
```
|
||||
|
||||
**Output On Success With Warnings**
|
||||
|
||||
```
|
||||
## Archive Complete (with warnings)
|
||||
|
||||
**Change:** <change-name>
|
||||
**Schema:** <schema-name>
|
||||
**Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/
|
||||
**Specs:** Sync skipped (user chose to skip)
|
||||
|
||||
**Warnings:**
|
||||
- Archived with 2 incomplete artifacts
|
||||
- Archived with 3 incomplete tasks
|
||||
- Delta spec sync was skipped (user chose to skip)
|
||||
|
||||
Review the archive if this was not intentional.
|
||||
```
|
||||
|
||||
**Output On Error (Archive Exists)**
|
||||
|
||||
```
|
||||
## Archive Failed
|
||||
|
||||
**Change:** <change-name>
|
||||
**Target:** openspec/changes/archive/YYYY-MM-DD-<name>/
|
||||
|
||||
Target archive directory already exists.
|
||||
|
||||
**Options:**
|
||||
1. Rename the existing archive
|
||||
2. Delete the existing archive if it's a duplicate
|
||||
3. Wait until a different date to archive
|
||||
```
|
||||
|
||||
**Guardrails**
|
||||
- Always prompt for change selection if not provided
|
||||
- Use artifact graph (openspec status --json) for completion checking
|
||||
- Don't block archive on warnings - just inform and confirm
|
||||
- Preserve .openspec.yaml when moving to archive (it moves with the directory)
|
||||
- Show clear summary of what happened
|
||||
- If sync is requested, use the Skill tool to invoke `openspec-sync-specs` (agent-driven)
|
||||
- If delta specs exist, always run the sync assessment and show the combined summary before prompting
|
||||
173
.claude/commands/opsx/explore.md
Normal file
173
.claude/commands/opsx/explore.md
Normal file
@@ -0,0 +1,173 @@
|
||||
---
|
||||
name: "OPSX: Explore"
|
||||
description: "Enter explore mode - think through ideas, investigate problems, clarify requirements"
|
||||
category: Workflow
|
||||
tags: [workflow, explore, experimental, thinking]
|
||||
---
|
||||
|
||||
Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
|
||||
|
||||
**IMPORTANT: Explore mode is for thinking, not implementing.** You may read files, search code, and investigate the codebase, but you must NEVER write code or implement features. If the user asks you to implement something, remind them to exit explore mode first and create a change proposal. You MAY create OpenSpec artifacts (proposals, designs, specs) if the user asks—that's capturing thinking, not implementing.
|
||||
|
||||
**This is a stance, not a workflow.** There are no fixed steps, no required sequence, no mandatory outputs. You're a thinking partner helping the user explore.
|
||||
|
||||
**Input**: The argument after `/opsx:explore` is whatever the user wants to think about. Could be:
|
||||
- A vague idea: "real-time collaboration"
|
||||
- A specific problem: "the auth system is getting unwieldy"
|
||||
- A change name: "add-dark-mode" (to explore in context of that change)
|
||||
- A comparison: "postgres vs sqlite for this"
|
||||
- Nothing (just enter explore mode)
|
||||
|
||||
---
|
||||
|
||||
## The Stance
|
||||
|
||||
- **Curious, not prescriptive** - Ask questions that emerge naturally, don't follow a script
|
||||
- **Open threads, not interrogations** - Surface multiple interesting directions and let the user follow what resonates. Don't funnel them through a single path of questions.
|
||||
- **Visual** - Use ASCII diagrams liberally when they'd help clarify thinking
|
||||
- **Adaptive** - Follow interesting threads, pivot when new information emerges
|
||||
- **Patient** - Don't rush to conclusions, let the shape of the problem emerge
|
||||
- **Grounded** - Explore the actual codebase when relevant, don't just theorize
|
||||
|
||||
---
|
||||
|
||||
## What You Might Do
|
||||
|
||||
Depending on what the user brings, you might:
|
||||
|
||||
**Explore the problem space**
|
||||
- Ask clarifying questions that emerge from what they said
|
||||
- Challenge assumptions
|
||||
- Reframe the problem
|
||||
- Find analogies
|
||||
|
||||
**Investigate the codebase**
|
||||
- Map existing architecture relevant to the discussion
|
||||
- Find integration points
|
||||
- Identify patterns already in use
|
||||
- Surface hidden complexity
|
||||
|
||||
**Compare options**
|
||||
- Brainstorm multiple approaches
|
||||
- Build comparison tables
|
||||
- Sketch tradeoffs
|
||||
- Recommend a path (if asked)
|
||||
|
||||
**Visualize**
|
||||
```
|
||||
┌─────────────────────────────────────────┐
|
||||
│ Use ASCII diagrams liberally │
|
||||
├─────────────────────────────────────────┤
|
||||
│ │
|
||||
│ ┌────────┐ ┌────────┐ │
|
||||
│ │ State │────────▶│ State │ │
|
||||
│ │ A │ │ B │ │
|
||||
│ └────────┘ └────────┘ │
|
||||
│ │
|
||||
│ System diagrams, state machines, │
|
||||
│ data flows, architecture sketches, │
|
||||
│ dependency graphs, comparison tables │
|
||||
│ │
|
||||
└─────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
**Surface risks and unknowns**
|
||||
- Identify what could go wrong
|
||||
- Find gaps in understanding
|
||||
- Suggest spikes or investigations
|
||||
|
||||
---
|
||||
|
||||
## OpenSpec Awareness
|
||||
|
||||
You have full context of the OpenSpec system. Use it naturally, don't force it.
|
||||
|
||||
### Check for context
|
||||
|
||||
At the start, quickly check what exists:
|
||||
```bash
|
||||
openspec list --json
|
||||
```
|
||||
|
||||
This tells you:
|
||||
- If there are active changes
|
||||
- Their names, schemas, and status
|
||||
- What the user might be working on
|
||||
|
||||
If the user mentioned a specific change name, read its artifacts for context.
|
||||
|
||||
### When no change exists
|
||||
|
||||
Think freely. When insights crystallize, you might offer:
|
||||
|
||||
- "This feels solid enough to start a change. Want me to create a proposal?"
|
||||
- Or keep exploring - no pressure to formalize
|
||||
|
||||
### When a change exists
|
||||
|
||||
If the user mentions a change or you detect one is relevant:
|
||||
|
||||
1. **Read existing artifacts for context**
|
||||
- `openspec/changes/<name>/proposal.md`
|
||||
- `openspec/changes/<name>/design.md`
|
||||
- `openspec/changes/<name>/tasks.md`
|
||||
- etc.
|
||||
|
||||
2. **Reference them naturally in conversation**
|
||||
- "Your design mentions using Redis, but we just realized SQLite fits better..."
|
||||
- "The proposal scopes this to premium users, but we're now thinking everyone..."
|
||||
|
||||
3. **Offer to capture when decisions are made**
|
||||
|
||||
| Insight Type | Where to Capture |
|
||||
|--------------|------------------|
|
||||
| New requirement discovered | `specs/<capability>/spec.md` |
|
||||
| Requirement changed | `specs/<capability>/spec.md` |
|
||||
| Design decision made | `design.md` |
|
||||
| Scope changed | `proposal.md` |
|
||||
| New work identified | `tasks.md` |
|
||||
| Assumption invalidated | Relevant artifact |
|
||||
|
||||
Example offers:
|
||||
- "That's a design decision. Capture it in design.md?"
|
||||
- "This is a new requirement. Add it to specs?"
|
||||
- "This changes scope. Update the proposal?"
|
||||
|
||||
4. **The user decides** - Offer and move on. Don't pressure. Don't auto-capture.
|
||||
|
||||
---
|
||||
|
||||
## What You Don't Have To Do
|
||||
|
||||
- Follow a script
|
||||
- Ask the same questions every time
|
||||
- Produce a specific artifact
|
||||
- Reach a conclusion
|
||||
- Stay on topic if a tangent is valuable
|
||||
- Be brief (this is thinking time)
|
||||
|
||||
---
|
||||
|
||||
## Ending Discovery
|
||||
|
||||
There's no required ending. Discovery might:
|
||||
|
||||
- **Flow into a proposal**: "Ready to start? I can create a change proposal."
|
||||
- **Result in artifact updates**: "Updated design.md with these decisions"
|
||||
- **Just provide clarity**: User has what they need, moves on
|
||||
- **Continue later**: "We can pick this up anytime"
|
||||
|
||||
When things crystallize, you might offer a summary - but it's optional. Sometimes the thinking IS the value.
|
||||
|
||||
---
|
||||
|
||||
## Guardrails
|
||||
|
||||
- **Don't implement** - Never write code or implement features. Creating OpenSpec artifacts is fine, writing application code is not.
|
||||
- **Don't fake understanding** - If something is unclear, dig deeper
|
||||
- **Don't rush** - Discovery is thinking time, not task time
|
||||
- **Don't force structure** - Let patterns emerge naturally
|
||||
- **Don't auto-capture** - Offer to save insights, don't just do it
|
||||
- **Do visualize** - A good diagram is worth many paragraphs
|
||||
- **Do explore the codebase** - Ground discussions in reality
|
||||
- **Do question assumptions** - Including the user's and your own
|
||||
106
.claude/commands/opsx/propose.md
Normal file
106
.claude/commands/opsx/propose.md
Normal file
@@ -0,0 +1,106 @@
|
||||
---
|
||||
name: "OPSX: Propose"
|
||||
description: Propose a new change - create it and generate all artifacts in one step
|
||||
category: Workflow
|
||||
tags: [workflow, artifacts, experimental]
|
||||
---
|
||||
|
||||
Propose a new change - create the change and generate all artifacts in one step.
|
||||
|
||||
I'll create a change with artifacts:
|
||||
- proposal.md (what & why)
|
||||
- design.md (how)
|
||||
- tasks.md (implementation steps)
|
||||
|
||||
When ready to implement, run /opsx:apply
|
||||
|
||||
---
|
||||
|
||||
**Input**: The argument after `/opsx:propose` is the change name (kebab-case), OR a description of what the user wants to build.
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **If no input provided, ask what they want to build**
|
||||
|
||||
Use the **AskUserQuestion tool** (open-ended, no preset options) to ask:
|
||||
> "What change do you want to work on? Describe what you want to build or fix."
|
||||
|
||||
From their description, derive a kebab-case name (e.g., "add user authentication" → `add-user-auth`).
|
||||
|
||||
**IMPORTANT**: Do NOT proceed without understanding what the user wants to build.
|
||||
|
||||
2. **Create the change directory**
|
||||
```bash
|
||||
openspec new change "<name>"
|
||||
```
|
||||
This creates a scaffolded change at `openspec/changes/<name>/` with `.openspec.yaml`.
|
||||
|
||||
3. **Get the artifact build order**
|
||||
```bash
|
||||
openspec status --change "<name>" --json
|
||||
```
|
||||
Parse the JSON to get:
|
||||
- `applyRequires`: array of artifact IDs needed before implementation (e.g., `["tasks"]`)
|
||||
- `artifacts`: list of all artifacts with their status and dependencies
|
||||
|
||||
4. **Create artifacts in sequence until apply-ready**
|
||||
|
||||
Use the **TodoWrite tool** to track progress through the artifacts.
|
||||
|
||||
Loop through artifacts in dependency order (artifacts with no pending dependencies first):
|
||||
|
||||
a. **For each artifact that is `ready` (dependencies satisfied)**:
|
||||
- Get instructions:
|
||||
```bash
|
||||
openspec instructions <artifact-id> --change "<name>" --json
|
||||
```
|
||||
- The instructions JSON includes:
|
||||
- `context`: Project background (constraints for you - do NOT include in output)
|
||||
- `rules`: Artifact-specific rules (constraints for you - do NOT include in output)
|
||||
- `template`: The structure to use for your output file
|
||||
- `instruction`: Schema-specific guidance for this artifact type
|
||||
- `outputPath`: Where to write the artifact
|
||||
- `dependencies`: Completed artifacts to read for context
|
||||
- Read any completed dependency files for context
|
||||
- Create the artifact file using `template` as the structure
|
||||
- Apply `context` and `rules` as constraints - but do NOT copy them into the file
|
||||
- Show brief progress: "Created <artifact-id>"
|
||||
|
||||
b. **Continue until all `applyRequires` artifacts are complete**
|
||||
- After creating each artifact, re-run `openspec status --change "<name>" --json`
|
||||
- Check if every artifact ID in `applyRequires` has `status: "done"` in the artifacts array
|
||||
- Stop when all `applyRequires` artifacts are done
|
||||
|
||||
c. **If an artifact requires user input** (unclear context):
|
||||
- Use **AskUserQuestion tool** to clarify
|
||||
- Then continue with creation
|
||||
|
||||
5. **Show final status**
|
||||
```bash
|
||||
openspec status --change "<name>"
|
||||
```
|
||||
|
||||
**Output**
|
||||
|
||||
After completing all artifacts, summarize:
|
||||
- Change name and location
|
||||
- List of artifacts created with brief descriptions
|
||||
- What's ready: "All artifacts created! Ready for implementation."
|
||||
- Prompt: "Run `/opsx:apply` to start implementing."
|
||||
|
||||
**Artifact Creation Guidelines**
|
||||
|
||||
- Follow the `instruction` field from `openspec instructions` for each artifact type
|
||||
- The schema defines what each artifact should contain - follow it
|
||||
- Read dependency artifacts for context before creating new ones
|
||||
- Use `template` as the structure for your output file - fill in its sections
|
||||
- **IMPORTANT**: `context` and `rules` are constraints for YOU, not content for the file
|
||||
- Do NOT copy `<context>`, `<rules>`, `<project_context>` blocks into the artifact
|
||||
- These guide what you write, but should never appear in the output
|
||||
|
||||
**Guardrails**
|
||||
- Create ALL artifacts needed for implementation (as defined by schema's `apply.requires`)
|
||||
- Always read dependency artifacts before creating a new one
|
||||
- If context is critically unclear, ask the user - but prefer making reasonable decisions to keep momentum
|
||||
- If a change with that name already exists, ask if user wants to continue it or create a new one
|
||||
- Verify each artifact file exists after writing before proceeding to next
|
||||
183
.claude/skills/continue/SKILL.md
Normal file
183
.claude/skills/continue/SKILL.md
Normal file
@@ -0,0 +1,183 @@
|
||||
---
|
||||
name: continue
|
||||
description: Capture a full project status snapshot so the next session can continue seamlessly from where this one left off. Use when the user is ending a session and wants to preserve context for resumption.
|
||||
license: MIT
|
||||
compatibility: Requires git. OpenSpec CLI optional (gracefully skipped if unavailable).
|
||||
metadata:
|
||||
author: sentryagent
|
||||
version: "1.0"
|
||||
generatedBy: "1.2.0"
|
||||
---
|
||||
|
||||
Capture the full current project status and store it in persistent memory so the next session can pick up exactly where this one left off — no context lost, no recap needed.
|
||||
|
||||
**Input**: No arguments required. Invoke at any point when ending a session.
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **Capture git state**
|
||||
|
||||
Run the following in parallel:
|
||||
```bash
|
||||
git status
|
||||
git branch --show-current
|
||||
git log --oneline -10
|
||||
git diff --stat HEAD
|
||||
git stash list
|
||||
```
|
||||
|
||||
Record:
|
||||
- Current branch name
|
||||
- Uncommitted files (staged and unstaged), with change type (M/A/D/?)
|
||||
- Last 10 commit messages (for continuity context)
|
||||
- Summary of diff stats if uncommitted changes exist
|
||||
- Any stashed work
|
||||
|
||||
2. **Capture OpenSpec change state**
|
||||
|
||||
Run `openspec list --json` to get all active changes.
|
||||
|
||||
For each active (non-archived) change, run:
|
||||
```bash
|
||||
openspec status --change "<name>" --json
|
||||
```
|
||||
|
||||
For each active change, also read its `tasks.md` to count:
|
||||
- Total tasks
|
||||
- Completed tasks (`- [x]`)
|
||||
- Pending tasks (`- [ ]`)
|
||||
- The text of the next pending task (to know what's up next)
|
||||
|
||||
Record per change:
|
||||
- Change name
|
||||
- Schema
|
||||
- Artifact completion (which are done, which are pending)
|
||||
- Task progress (X of Y complete)
|
||||
- Next pending task description
|
||||
- Any delta specs present (`openspec/changes/<name>/specs/`)
|
||||
|
||||
**If `openspec` CLI is unavailable or fails:** Note it and skip this section gracefully.
|
||||
**If no active changes:** Note that there are no active OpenSpec changes.
|
||||
|
||||
3. **Capture in-session conversation context**
|
||||
|
||||
Summarize what was worked on in this session based on the conversation:
|
||||
- What was the user trying to accomplish?
|
||||
- What was completed?
|
||||
- What was left in-progress or blocked?
|
||||
- Any key decisions made during this session
|
||||
- Any open questions or next actions the user mentioned
|
||||
|
||||
Keep this factual and brief — 3–8 bullet points.
|
||||
|
||||
4. **Capture memory file state**
|
||||
|
||||
Read `MEMORY.md` from the project memory directory:
|
||||
`~/.claude/projects/-home-ubuntu-vj-ai-agents-dev-sentryagent-idp/memory/MEMORY.md`
|
||||
|
||||
Note the existing memory entries to avoid duplication in the next step.
|
||||
|
||||
5. **Write session snapshot to memory**
|
||||
|
||||
Write a `session_snapshot.md` file to the project memory directory:
|
||||
`~/.claude/projects/-home-ubuntu-vj-ai-agents-dev-sentryagent-idp/memory/session_snapshot.md`
|
||||
|
||||
Use this structure:
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: Session Snapshot
|
||||
description: Last session status — git state, OpenSpec progress, and conversation context for seamless resumption
|
||||
type: project
|
||||
---
|
||||
|
||||
**Session ended:** YYYY-MM-DD (today's date)
|
||||
|
||||
## Git State
|
||||
|
||||
**Branch:** <branch-name>
|
||||
**Uncommitted changes:** <count> files (<list filenames>)
|
||||
**Last commit:** <hash> <message>
|
||||
|
||||
<If uncommitted changes exist, list them with their status>
|
||||
|
||||
<If stashes exist, list them>
|
||||
|
||||
## OpenSpec Changes
|
||||
|
||||
<For each active change:>
|
||||
### <change-name>
|
||||
- **Schema:** <schema-name>
|
||||
- **Artifacts:** <done-count>/<total-count> complete (<list incomplete artifact names>)
|
||||
- **Tasks:** <done-count>/<total-count> complete
|
||||
- **Next task:** <text of next pending task>
|
||||
- **Delta specs:** <present / none>
|
||||
|
||||
<If no active changes:> No active OpenSpec changes.
|
||||
|
||||
## Session Work
|
||||
|
||||
<Bullet list of what was worked on, completed, and left in-progress>
|
||||
|
||||
## Next Actions
|
||||
|
||||
<Bullet list of concrete next steps to resume — derived from pending tasks, blockers, open questions>
|
||||
```
|
||||
|
||||
**IMPORTANT:** Always overwrite `session_snapshot.md` — this is a rolling snapshot, not a log. Only the most recent session state matters.
|
||||
|
||||
6. **Update MEMORY.md index**
|
||||
|
||||
Read the current `MEMORY.md`. If `session_snapshot.md` is not already listed, add it:
|
||||
```
|
||||
- [Session Snapshot](session_snapshot.md) — Last session: YYYY-MM-DD | branch: <name> | <N> active changes | <N> uncommitted files
|
||||
```
|
||||
|
||||
If it is already listed, update the line to reflect today's date and current state.
|
||||
|
||||
Write the updated `MEMORY.md`.
|
||||
|
||||
7. **Display break summary**
|
||||
|
||||
Show a clean summary so the user knows the snapshot is complete:
|
||||
|
||||
```
|
||||
## Snapshot Saved — See You Next Session
|
||||
|
||||
**Branch:** <branch-name>
|
||||
**Uncommitted files:** <count> (<filenames>)
|
||||
**Active changes:** <count>
|
||||
|
||||
<For each active change:>
|
||||
- <change-name>: <done>/<total> tasks complete — Next: "<next task text>"
|
||||
|
||||
**Session context saved to memory.**
|
||||
|
||||
To resume: start a new session and run /continue — Claude will load the snapshot and pick up where you left off.
|
||||
```
|
||||
|
||||
**Output On Success**
|
||||
|
||||
```
|
||||
## Snapshot Saved — See You Next Session
|
||||
|
||||
**Branch:** develop
|
||||
**Uncommitted files:** 3 (src/auth/token.ts, tests/auth.test.ts, README.md)
|
||||
**Active changes:** 1
|
||||
|
||||
- add-agent-auth: 4/7 tasks complete — Next: "Implement JWT signing with RS256"
|
||||
|
||||
**Session context saved to memory.**
|
||||
|
||||
To resume: start a new session and run /continue — Claude will load the snapshot and pick up where you left off.
|
||||
```
|
||||
|
||||
**Guardrails**
|
||||
- Always overwrite `session_snapshot.md` — do NOT append or create versioned copies
|
||||
- Never include secrets, tokens, or credentials in the snapshot
|
||||
- If `openspec list` fails (CLI not available), note that and skip OpenSpec capture gracefully
|
||||
- If git is unavailable, note that and skip git capture gracefully
|
||||
- Keep the session context summary factual — no speculation beyond what the user explicitly stated
|
||||
- The MEMORY.md index line for `session_snapshot.md` must stay under 150 characters
|
||||
- This skill does NOT commit code, push branches, or modify any project files — it only writes to the memory directory
|
||||
- Session date must use the actual current date (not a placeholder)
|
||||
156
.claude/skills/openspec-apply-change/SKILL.md
Normal file
156
.claude/skills/openspec-apply-change/SKILL.md
Normal file
@@ -0,0 +1,156 @@
|
||||
---
|
||||
name: openspec-apply-change
|
||||
description: Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks.
|
||||
license: MIT
|
||||
compatibility: Requires openspec CLI.
|
||||
metadata:
|
||||
author: openspec
|
||||
version: "1.0"
|
||||
generatedBy: "1.2.0"
|
||||
---
|
||||
|
||||
Implement tasks from an OpenSpec change.
|
||||
|
||||
**Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **Select the change**
|
||||
|
||||
If a name is provided, use it. Otherwise:
|
||||
- Infer from conversation context if the user mentioned a change
|
||||
- Auto-select if only one active change exists
|
||||
- If ambiguous, run `openspec list --json` to get available changes and use the **AskUserQuestion tool** to let the user select
|
||||
|
||||
Always announce: "Using change: <name>" and how to override (e.g., `/opsx:apply <other>`).
|
||||
|
||||
2. **Check status to understand the schema**
|
||||
```bash
|
||||
openspec status --change "<name>" --json
|
||||
```
|
||||
Parse the JSON to understand:
|
||||
- `schemaName`: The workflow being used (e.g., "spec-driven")
|
||||
- Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
|
||||
|
||||
3. **Get apply instructions**
|
||||
|
||||
```bash
|
||||
openspec instructions apply --change "<name>" --json
|
||||
```
|
||||
|
||||
This returns:
|
||||
- Context file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
|
||||
- Progress (total, complete, remaining)
|
||||
- Task list with status
|
||||
- Dynamic instruction based on current state
|
||||
|
||||
**Handle states:**
|
||||
- If `state: "blocked"` (missing artifacts): show message, suggest using openspec-continue-change
|
||||
- If `state: "all_done"`: congratulate, suggest archive
|
||||
- Otherwise: proceed to implementation
|
||||
|
||||
4. **Read context files**
|
||||
|
||||
Read the files listed in `contextFiles` from the apply instructions output.
|
||||
The files depend on the schema being used:
|
||||
- **spec-driven**: proposal, specs, design, tasks
|
||||
- Other schemas: follow the contextFiles from CLI output
|
||||
|
||||
5. **Show current progress**
|
||||
|
||||
Display:
|
||||
- Schema being used
|
||||
- Progress: "N/M tasks complete"
|
||||
- Remaining tasks overview
|
||||
- Dynamic instruction from CLI
|
||||
|
||||
6. **Implement tasks (loop until done or blocked)**
|
||||
|
||||
For each pending task:
|
||||
- Show which task is being worked on
|
||||
- Make the code changes required
|
||||
- Keep changes minimal and focused
|
||||
- Mark task complete in the tasks file: `- [ ]` → `- [x]`
|
||||
- Continue to next task
|
||||
|
||||
**Pause if:**
|
||||
- Task is unclear → ask for clarification
|
||||
- Implementation reveals a design issue → suggest updating artifacts
|
||||
- Error or blocker encountered → report and wait for guidance
|
||||
- User interrupts
|
||||
|
||||
7. **On completion or pause, show status**
|
||||
|
||||
Display:
|
||||
- Tasks completed this session
|
||||
- Overall progress: "N/M tasks complete"
|
||||
- If all done: suggest archive
|
||||
- If paused: explain why and wait for guidance
|
||||
|
||||
**Output During Implementation**
|
||||
|
||||
```
|
||||
## Implementing: <change-name> (schema: <schema-name>)
|
||||
|
||||
Working on task 3/7: <task description>
|
||||
[...implementation happening...]
|
||||
✓ Task complete
|
||||
|
||||
Working on task 4/7: <task description>
|
||||
[...implementation happening...]
|
||||
✓ Task complete
|
||||
```
|
||||
|
||||
**Output On Completion**
|
||||
|
||||
```
|
||||
## Implementation Complete
|
||||
|
||||
**Change:** <change-name>
|
||||
**Schema:** <schema-name>
|
||||
**Progress:** 7/7 tasks complete ✓
|
||||
|
||||
### Completed This Session
|
||||
- [x] Task 1
|
||||
- [x] Task 2
|
||||
...
|
||||
|
||||
All tasks complete! Ready to archive this change.
|
||||
```
|
||||
|
||||
**Output On Pause (Issue Encountered)**
|
||||
|
||||
```
|
||||
## Implementation Paused
|
||||
|
||||
**Change:** <change-name>
|
||||
**Schema:** <schema-name>
|
||||
**Progress:** 4/7 tasks complete
|
||||
|
||||
### Issue Encountered
|
||||
<description of the issue>
|
||||
|
||||
**Options:**
|
||||
1. <option 1>
|
||||
2. <option 2>
|
||||
3. Other approach
|
||||
|
||||
What would you like to do?
|
||||
```
|
||||
|
||||
**Guardrails**
|
||||
- Keep going through tasks until done or blocked
|
||||
- Always read context files before starting (from the apply instructions output)
|
||||
- If task is ambiguous, pause and ask before implementing
|
||||
- If implementation reveals issues, pause and suggest artifact updates
|
||||
- Keep code changes minimal and scoped to each task
|
||||
- Update task checkbox immediately after completing each task
|
||||
- Pause on errors, blockers, or unclear requirements - don't guess
|
||||
- Use contextFiles from CLI output, don't assume specific file names
|
||||
|
||||
**Fluid Workflow Integration**
|
||||
|
||||
This skill supports the "actions on a change" model:
|
||||
|
||||
- **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
|
||||
- **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly
|
||||
114
.claude/skills/openspec-archive-change/SKILL.md
Normal file
114
.claude/skills/openspec-archive-change/SKILL.md
Normal file
@@ -0,0 +1,114 @@
|
||||
---
|
||||
name: openspec-archive-change
|
||||
description: Archive a completed change in the experimental workflow. Use when the user wants to finalize and archive a change after implementation is complete.
|
||||
license: MIT
|
||||
compatibility: Requires openspec CLI.
|
||||
metadata:
|
||||
author: openspec
|
||||
version: "1.0"
|
||||
generatedBy: "1.2.0"
|
||||
---
|
||||
|
||||
Archive a completed change in the experimental workflow.
|
||||
|
||||
**Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **If no change name provided, prompt for selection**
|
||||
|
||||
Run `openspec list --json` to get available changes. Use the **AskUserQuestion tool** to let the user select.
|
||||
|
||||
Show only active changes (not already archived).
|
||||
Include the schema used for each change if available.
|
||||
|
||||
**IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
|
||||
|
||||
2. **Check artifact completion status**
|
||||
|
||||
Run `openspec status --change "<name>" --json` to check artifact completion.
|
||||
|
||||
Parse the JSON to understand:
|
||||
- `schemaName`: The workflow being used
|
||||
- `artifacts`: List of artifacts with their status (`done` or other)
|
||||
|
||||
**If any artifacts are not `done`:**
|
||||
- Display warning listing incomplete artifacts
|
||||
- Use **AskUserQuestion tool** to confirm user wants to proceed
|
||||
- Proceed if user confirms
|
||||
|
||||
3. **Check task completion status**
|
||||
|
||||
Read the tasks file (typically `tasks.md`) to check for incomplete tasks.
|
||||
|
||||
Count tasks marked with `- [ ]` (incomplete) vs `- [x]` (complete).
|
||||
|
||||
**If incomplete tasks found:**
|
||||
- Display warning showing count of incomplete tasks
|
||||
- Use **AskUserQuestion tool** to confirm user wants to proceed
|
||||
- Proceed if user confirms
|
||||
|
||||
**If no tasks file exists:** Proceed without task-related warning.
|
||||
|
||||
4. **Assess delta spec sync state**
|
||||
|
||||
Check for delta specs at `openspec/changes/<name>/specs/`. If none exist, proceed without sync prompt.
|
||||
|
||||
**If delta specs exist:**
|
||||
- Compare each delta spec with its corresponding main spec at `openspec/specs/<capability>/spec.md`
|
||||
- Determine what changes would be applied (adds, modifications, removals, renames)
|
||||
- Show a combined summary before prompting
|
||||
|
||||
**Prompt options:**
|
||||
- If changes needed: "Sync now (recommended)", "Archive without syncing"
|
||||
- If already synced: "Archive now", "Sync anyway", "Cancel"
|
||||
|
||||
If user chooses sync, use Task tool (subagent_type: "general-purpose", prompt: "Use Skill tool to invoke openspec-sync-specs for change '<name>'. Delta spec analysis: <include the analyzed delta spec summary>"). Proceed to archive regardless of choice.
|
||||
|
||||
5. **Perform the archive**
|
||||
|
||||
Create the archive directory if it doesn't exist:
|
||||
```bash
|
||||
mkdir -p openspec/changes/archive
|
||||
```
|
||||
|
||||
Generate target name using current date: `YYYY-MM-DD-<change-name>`
|
||||
|
||||
**Check if target already exists:**
|
||||
- If yes: Fail with error, suggest renaming existing archive or using different date
|
||||
- If no: Move the change directory to archive
|
||||
|
||||
```bash
|
||||
mv openspec/changes/<name> openspec/changes/archive/YYYY-MM-DD-<name>
|
||||
```
|
||||
|
||||
6. **Display summary**
|
||||
|
||||
Show archive completion summary including:
|
||||
- Change name
|
||||
- Schema that was used
|
||||
- Archive location
|
||||
- Whether specs were synced (if applicable)
|
||||
- Note about any warnings (incomplete artifacts/tasks)
|
||||
|
||||
**Output On Success**
|
||||
|
||||
```
|
||||
## Archive Complete
|
||||
|
||||
**Change:** <change-name>
|
||||
**Schema:** <schema-name>
|
||||
**Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/
|
||||
**Specs:** ✓ Synced to main specs (or "No delta specs" or "Sync skipped")
|
||||
|
||||
All artifacts complete. All tasks complete.
|
||||
```
|
||||
|
||||
**Guardrails**
|
||||
- Always prompt for change selection if not provided
|
||||
- Use artifact graph (openspec status --json) for completion checking
|
||||
- Don't block archive on warnings - just inform and confirm
|
||||
- Preserve .openspec.yaml when moving to archive (it moves with the directory)
|
||||
- Show clear summary of what happened
|
||||
- If sync is requested, use openspec-sync-specs approach (agent-driven)
|
||||
- If delta specs exist, always run the sync assessment and show the combined summary before prompting
|
||||
288
.claude/skills/openspec-explore/SKILL.md
Normal file
288
.claude/skills/openspec-explore/SKILL.md
Normal file
@@ -0,0 +1,288 @@
|
||||
---
|
||||
name: openspec-explore
|
||||
description: Enter explore mode - a thinking partner for exploring ideas, investigating problems, and clarifying requirements. Use when the user wants to think through something before or during a change.
|
||||
license: MIT
|
||||
compatibility: Requires openspec CLI.
|
||||
metadata:
|
||||
author: openspec
|
||||
version: "1.0"
|
||||
generatedBy: "1.2.0"
|
||||
---
|
||||
|
||||
Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
|
||||
|
||||
**IMPORTANT: Explore mode is for thinking, not implementing.** You may read files, search code, and investigate the codebase, but you must NEVER write code or implement features. If the user asks you to implement something, remind them to exit explore mode first and create a change proposal. You MAY create OpenSpec artifacts (proposals, designs, specs) if the user asks—that's capturing thinking, not implementing.
|
||||
|
||||
**This is a stance, not a workflow.** There are no fixed steps, no required sequence, no mandatory outputs. You're a thinking partner helping the user explore.
|
||||
|
||||
---
|
||||
|
||||
## The Stance
|
||||
|
||||
- **Curious, not prescriptive** - Ask questions that emerge naturally, don't follow a script
|
||||
- **Open threads, not interrogations** - Surface multiple interesting directions and let the user follow what resonates. Don't funnel them through a single path of questions.
|
||||
- **Visual** - Use ASCII diagrams liberally when they'd help clarify thinking
|
||||
- **Adaptive** - Follow interesting threads, pivot when new information emerges
|
||||
- **Patient** - Don't rush to conclusions, let the shape of the problem emerge
|
||||
- **Grounded** - Explore the actual codebase when relevant, don't just theorize
|
||||
|
||||
---
|
||||
|
||||
## What You Might Do
|
||||
|
||||
Depending on what the user brings, you might:
|
||||
|
||||
**Explore the problem space**
|
||||
- Ask clarifying questions that emerge from what they said
|
||||
- Challenge assumptions
|
||||
- Reframe the problem
|
||||
- Find analogies
|
||||
|
||||
**Investigate the codebase**
|
||||
- Map existing architecture relevant to the discussion
|
||||
- Find integration points
|
||||
- Identify patterns already in use
|
||||
- Surface hidden complexity
|
||||
|
||||
**Compare options**
|
||||
- Brainstorm multiple approaches
|
||||
- Build comparison tables
|
||||
- Sketch tradeoffs
|
||||
- Recommend a path (if asked)
|
||||
|
||||
**Visualize**
|
||||
```
|
||||
┌─────────────────────────────────────────┐
|
||||
│ Use ASCII diagrams liberally │
|
||||
├─────────────────────────────────────────┤
|
||||
│ │
|
||||
│ ┌────────┐ ┌────────┐ │
|
||||
│ │ State │────────▶│ State │ │
|
||||
│ │ A │ │ B │ │
|
||||
│ └────────┘ └────────┘ │
|
||||
│ │
|
||||
│ System diagrams, state machines, │
|
||||
│ data flows, architecture sketches, │
|
||||
│ dependency graphs, comparison tables │
|
||||
│ │
|
||||
└─────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
**Surface risks and unknowns**
|
||||
- Identify what could go wrong
|
||||
- Find gaps in understanding
|
||||
- Suggest spikes or investigations
|
||||
|
||||
---
|
||||
|
||||
## OpenSpec Awareness
|
||||
|
||||
You have full context of the OpenSpec system. Use it naturally, don't force it.
|
||||
|
||||
### Check for context
|
||||
|
||||
At the start, quickly check what exists:
|
||||
```bash
|
||||
openspec list --json
|
||||
```
|
||||
|
||||
This tells you:
|
||||
- If there are active changes
|
||||
- Their names, schemas, and status
|
||||
- What the user might be working on
|
||||
|
||||
### When no change exists
|
||||
|
||||
Think freely. When insights crystallize, you might offer:
|
||||
|
||||
- "This feels solid enough to start a change. Want me to create a proposal?"
|
||||
- Or keep exploring - no pressure to formalize
|
||||
|
||||
### When a change exists
|
||||
|
||||
If the user mentions a change or you detect one is relevant:
|
||||
|
||||
1. **Read existing artifacts for context**
|
||||
- `openspec/changes/<name>/proposal.md`
|
||||
- `openspec/changes/<name>/design.md`
|
||||
- `openspec/changes/<name>/tasks.md`
|
||||
- etc.
|
||||
|
||||
2. **Reference them naturally in conversation**
|
||||
- "Your design mentions using Redis, but we just realized SQLite fits better..."
|
||||
- "The proposal scopes this to premium users, but we're now thinking everyone..."
|
||||
|
||||
3. **Offer to capture when decisions are made**
|
||||
|
||||
| Insight Type | Where to Capture |
|
||||
|--------------|------------------|
|
||||
| New requirement discovered | `specs/<capability>/spec.md` |
|
||||
| Requirement changed | `specs/<capability>/spec.md` |
|
||||
| Design decision made | `design.md` |
|
||||
| Scope changed | `proposal.md` |
|
||||
| New work identified | `tasks.md` |
|
||||
| Assumption invalidated | Relevant artifact |
|
||||
|
||||
Example offers:
|
||||
- "That's a design decision. Capture it in design.md?"
|
||||
- "This is a new requirement. Add it to specs?"
|
||||
- "This changes scope. Update the proposal?"
|
||||
|
||||
4. **The user decides** - Offer and move on. Don't pressure. Don't auto-capture.
|
||||
|
||||
---
|
||||
|
||||
## What You Don't Have To Do
|
||||
|
||||
- Follow a script
|
||||
- Ask the same questions every time
|
||||
- Produce a specific artifact
|
||||
- Reach a conclusion
|
||||
- Stay on topic if a tangent is valuable
|
||||
- Be brief (this is thinking time)
|
||||
|
||||
---
|
||||
|
||||
## Handling Different Entry Points
|
||||
|
||||
**User brings a vague idea:**
|
||||
```
|
||||
User: I'm thinking about adding real-time collaboration
|
||||
|
||||
You: Real-time collab is a big space. Let me think about this...
|
||||
|
||||
COLLABORATION SPECTRUM
|
||||
════════════════════════════════════════════
|
||||
|
||||
Awareness Coordination Sync
|
||||
│ │ │
|
||||
▼ ▼ ▼
|
||||
┌────────┐ ┌────────┐ ┌────────┐
|
||||
│Presence│ │Cursors │ │ CRDT │
|
||||
│ "3 │ │ Multi │ │Conflict│
|
||||
│online" │ │ select │ │ free │
|
||||
└────────┘ └────────┘ └────────┘
|
||||
│ │ │
|
||||
trivial moderate complex
|
||||
|
||||
Where's your head at?
|
||||
```
|
||||
|
||||
**User brings a specific problem:**
|
||||
```
|
||||
User: The auth system is a mess
|
||||
|
||||
You: [reads codebase]
|
||||
|
||||
┌─────────────────────────────────────────────┐
|
||||
│ CURRENT AUTH FLOW │
|
||||
└─────────────────────────────────────────────┘
|
||||
│
|
||||
┌─────────────┼─────────────┐
|
||||
▼ ▼ ▼
|
||||
┌─────────┐ ┌─────────┐ ┌─────────┐
|
||||
│ Google │ │ GitHub │ │ Email │
|
||||
│ OAuth │ │ OAuth │ │ Magic │
|
||||
└────┬────┘ └────┬────┘ └────┬────┘
|
||||
│ │ │
|
||||
└─────────────┼─────────────┘
|
||||
▼
|
||||
┌───────────┐
|
||||
│ Session │
|
||||
└─────┬─────┘
|
||||
│
|
||||
▼
|
||||
┌───────────┐
|
||||
│ Perms │
|
||||
└───────────┘
|
||||
|
||||
I see three tangles. Which one's burning?
|
||||
```
|
||||
|
||||
**User is stuck mid-implementation:**
|
||||
```
|
||||
User: /opsx:explore add-auth-system
|
||||
The OAuth integration is more complex than expected
|
||||
|
||||
You: [reads change artifacts]
|
||||
|
||||
You're on task 4: "Implement OAuth flow"
|
||||
|
||||
Let me trace what's involved...
|
||||
|
||||
[draws diagram, explores options, suggests paths]
|
||||
|
||||
Want to update the design to reflect this?
|
||||
Or add a spike task to investigate?
|
||||
```
|
||||
|
||||
**User wants to compare options:**
|
||||
```
|
||||
User: Should we use Postgres or SQLite?
|
||||
|
||||
You: Generic answer is boring. What's the context?
|
||||
|
||||
User: A CLI tool that tracks local dev environments
|
||||
|
||||
You: That changes everything.
|
||||
|
||||
┌─────────────────────────────────────────────────┐
|
||||
│ CLI TOOL DATA STORAGE │
|
||||
└─────────────────────────────────────────────────┘
|
||||
|
||||
Key constraints:
|
||||
• No daemon running
|
||||
• Must work offline
|
||||
• Single user
|
||||
|
||||
SQLite Postgres
|
||||
Deployment embedded ✓ needs server ✗
|
||||
Offline yes ✓ no ✗
|
||||
Single file yes ✓ no ✗
|
||||
|
||||
SQLite. Not even close.
|
||||
|
||||
Unless... is there a sync component?
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Ending Discovery
|
||||
|
||||
There's no required ending. Discovery might:
|
||||
|
||||
- **Flow into a proposal**: "Ready to start? I can create a change proposal."
|
||||
- **Result in artifact updates**: "Updated design.md with these decisions"
|
||||
- **Just provide clarity**: User has what they need, moves on
|
||||
- **Continue later**: "We can pick this up anytime"
|
||||
|
||||
When it feels like things are crystallizing, you might summarize:
|
||||
|
||||
```
|
||||
## What We Figured Out
|
||||
|
||||
**The problem**: [crystallized understanding]
|
||||
|
||||
**The approach**: [if one emerged]
|
||||
|
||||
**Open questions**: [if any remain]
|
||||
|
||||
**Next steps** (if ready):
|
||||
- Create a change proposal
|
||||
- Keep exploring: just keep talking
|
||||
```
|
||||
|
||||
But this summary is optional. Sometimes the thinking IS the value.
|
||||
|
||||
---
|
||||
|
||||
## Guardrails
|
||||
|
||||
- **Don't implement** - Never write code or implement features. Creating OpenSpec artifacts is fine, writing application code is not.
|
||||
- **Don't fake understanding** - If something is unclear, dig deeper
|
||||
- **Don't rush** - Discovery is thinking time, not task time
|
||||
- **Don't force structure** - Let patterns emerge naturally
|
||||
- **Don't auto-capture** - Offer to save insights, don't just do it
|
||||
- **Do visualize** - A good diagram is worth many paragraphs
|
||||
- **Do explore the codebase** - Ground discussions in reality
|
||||
- **Do question assumptions** - Including the user's and your own
|
||||
155
.claude/skills/openspec-project-status/SKILL.md
Normal file
155
.claude/skills/openspec-project-status/SKILL.md
Normal file
@@ -0,0 +1,155 @@
|
||||
---
|
||||
name: openspec-project-status
|
||||
description: Show a human-readable summary of all OpenSpec changes — active, archived, artifact completion, and task progress. Use when the user wants to see the current state of the project's OpenSpec changes.
|
||||
license: MIT
|
||||
compatibility: Requires openspec CLI.
|
||||
metadata:
|
||||
author: sentryagent
|
||||
version: "1.0"
|
||||
generatedBy: "1.2.0"
|
||||
---
|
||||
|
||||
Show the full OpenSpec project status in a clear, human-readable format. No raw JSON — just a clean picture of where the project stands.
|
||||
|
||||
**Input**: No arguments required.
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **Get all changes**
|
||||
|
||||
Run:
|
||||
```bash
|
||||
openspec list --json
|
||||
```
|
||||
|
||||
Separate results into:
|
||||
- **Active changes** (not in `archive/`)
|
||||
- **Archived changes** (in `archive/`)
|
||||
|
||||
If the command fails or no changes exist, display a friendly empty state (see Output section).
|
||||
|
||||
2. **For each active change, gather full status**
|
||||
|
||||
Run in parallel for all active changes:
|
||||
```bash
|
||||
openspec status --change "<name>" --json
|
||||
```
|
||||
|
||||
Also read each change's `tasks.md` to extract:
|
||||
- Total task count
|
||||
- Completed tasks (`- [x]`)
|
||||
- Pending tasks (`- [ ]`)
|
||||
- Text of the **next pending task** (first `- [ ]` item)
|
||||
|
||||
Also check for delta specs at `openspec/changes/<name>/specs/` — note if present.
|
||||
|
||||
3. **For archived changes**
|
||||
|
||||
List them by archive date (newest first). No need to read full status — just show name and archive date from the folder name (`YYYY-MM-DD-<name>`).
|
||||
|
||||
4. **Render the human-readable status report**
|
||||
|
||||
Use the output format defined below.
|
||||
|
||||
**Output Format**
|
||||
|
||||
```
|
||||
## OpenSpec Project Status
|
||||
|
||||
### Active Changes (<count>)
|
||||
|
||||
────────────────────────────────────────
|
||||
<change-name>
|
||||
────────────────────────────────────────
|
||||
Schema: <schema-name>
|
||||
Phase: <inferred phase label>
|
||||
|
||||
Artifacts
|
||||
✓ proposal done
|
||||
✓ design done
|
||||
◌ tasks pending
|
||||
|
||||
Tasks <done>/<total> complete
|
||||
████████░░░░░░░░ 50%
|
||||
Next: "<text of next pending task>"
|
||||
|
||||
Delta Specs <present / none>
|
||||
|
||||
────────────────────────────────────────
|
||||
|
||||
<Repeat for each active change>
|
||||
|
||||
---
|
||||
|
||||
### Archived Changes (<count>)
|
||||
|
||||
2026-03-20 add-initial-auth
|
||||
2026-03-15 setup-ci-pipeline
|
||||
|
||||
---
|
||||
|
||||
### Summary
|
||||
|
||||
Active changes: <N>
|
||||
Ready to apply: <N>
|
||||
In progress: <N>
|
||||
Complete: <N>
|
||||
Archived: <N>
|
||||
```
|
||||
|
||||
**Phase inference rules** (derive strictly from actual artifact + task state):
|
||||
- `Proposing` — proposal artifact is not done
|
||||
- `Designing` — proposal done, design not done
|
||||
- `Speccing` — design done, tasks artifact not done
|
||||
- `Ready to Implement` — all artifacts done, 0 tasks complete
|
||||
- `In Progress` — all artifacts done, some tasks complete but not all
|
||||
- `Complete` — all artifacts done, all tasks complete (not yet archived)
|
||||
|
||||
**Progress bar rules:**
|
||||
- 16 chars wide: `█` per completed segment, `░` for remaining
|
||||
- Show percentage after bar
|
||||
- If 0 tasks: show `No tasks yet`
|
||||
- If all tasks done: show `████████████████ 100% All done!`
|
||||
|
||||
**Artifact status icons:**
|
||||
- `✓` — done
|
||||
- `◌` — pending / not started
|
||||
|
||||
**Output: No active changes**
|
||||
|
||||
```
|
||||
## OpenSpec Project Status
|
||||
|
||||
### Active Changes (0)
|
||||
|
||||
No active changes. Start one with /opsx:propose
|
||||
|
||||
---
|
||||
|
||||
### Archived Changes (<count>)
|
||||
|
||||
...
|
||||
|
||||
### Summary
|
||||
|
||||
Active changes: 0
|
||||
Archived: <N>
|
||||
```
|
||||
|
||||
**Output: OpenSpec CLI unavailable**
|
||||
|
||||
```
|
||||
## OpenSpec Project Status
|
||||
|
||||
OpenSpec CLI not available. Cannot read change data.
|
||||
|
||||
Make sure `openspec` is installed and accessible in your PATH.
|
||||
```
|
||||
|
||||
**Guardrails**
|
||||
- Never show raw JSON — always translate to human-readable output
|
||||
- Never guess artifact or task state — always read from actual files and CLI output
|
||||
- If `tasks.md` does not exist for a change, show `No tasks file` instead of 0/0
|
||||
- Archived changes are display-only — never modify them
|
||||
- Phase labels must be inferred strictly from actual artifact + task state, not assumed
|
||||
- If `openspec status` fails for a specific change, show that change with `Status unavailable` and continue
|
||||
110
.claude/skills/openspec-propose/SKILL.md
Normal file
110
.claude/skills/openspec-propose/SKILL.md
Normal file
@@ -0,0 +1,110 @@
|
||||
---
|
||||
name: openspec-propose
|
||||
description: Propose a new change with all artifacts generated in one step. Use when the user wants to quickly describe what they want to build and get a complete proposal with design, specs, and tasks ready for implementation.
|
||||
license: MIT
|
||||
compatibility: Requires openspec CLI.
|
||||
metadata:
|
||||
author: openspec
|
||||
version: "1.0"
|
||||
generatedBy: "1.2.0"
|
||||
---
|
||||
|
||||
Propose a new change - create the change and generate all artifacts in one step.
|
||||
|
||||
I'll create a change with artifacts:
|
||||
- proposal.md (what & why)
|
||||
- design.md (how)
|
||||
- tasks.md (implementation steps)
|
||||
|
||||
When ready to implement, run /opsx:apply
|
||||
|
||||
---
|
||||
|
||||
**Input**: The user's request should include a change name (kebab-case) OR a description of what they want to build.
|
||||
|
||||
**Steps**
|
||||
|
||||
1. **If no clear input provided, ask what they want to build**
|
||||
|
||||
Use the **AskUserQuestion tool** (open-ended, no preset options) to ask:
|
||||
> "What change do you want to work on? Describe what you want to build or fix."
|
||||
|
||||
From their description, derive a kebab-case name (e.g., "add user authentication" → `add-user-auth`).
|
||||
|
||||
**IMPORTANT**: Do NOT proceed without understanding what the user wants to build.
|
||||
|
||||
2. **Create the change directory**
|
||||
```bash
|
||||
openspec new change "<name>"
|
||||
```
|
||||
This creates a scaffolded change at `openspec/changes/<name>/` with `.openspec.yaml`.
|
||||
|
||||
3. **Get the artifact build order**
|
||||
```bash
|
||||
openspec status --change "<name>" --json
|
||||
```
|
||||
Parse the JSON to get:
|
||||
- `applyRequires`: array of artifact IDs needed before implementation (e.g., `["tasks"]`)
|
||||
- `artifacts`: list of all artifacts with their status and dependencies
|
||||
|
||||
4. **Create artifacts in sequence until apply-ready**
|
||||
|
||||
Use the **TodoWrite tool** to track progress through the artifacts.
|
||||
|
||||
Loop through artifacts in dependency order (artifacts with no pending dependencies first):
|
||||
|
||||
a. **For each artifact that is `ready` (dependencies satisfied)**:
|
||||
- Get instructions:
|
||||
```bash
|
||||
openspec instructions <artifact-id> --change "<name>" --json
|
||||
```
|
||||
- The instructions JSON includes:
|
||||
- `context`: Project background (constraints for you - do NOT include in output)
|
||||
- `rules`: Artifact-specific rules (constraints for you - do NOT include in output)
|
||||
- `template`: The structure to use for your output file
|
||||
- `instruction`: Schema-specific guidance for this artifact type
|
||||
- `outputPath`: Where to write the artifact
|
||||
- `dependencies`: Completed artifacts to read for context
|
||||
- Read any completed dependency files for context
|
||||
- Create the artifact file using `template` as the structure
|
||||
- Apply `context` and `rules` as constraints - but do NOT copy them into the file
|
||||
- Show brief progress: "Created <artifact-id>"
|
||||
|
||||
b. **Continue until all `applyRequires` artifacts are complete**
|
||||
- After creating each artifact, re-run `openspec status --change "<name>" --json`
|
||||
- Check if every artifact ID in `applyRequires` has `status: "done"` in the artifacts array
|
||||
- Stop when all `applyRequires` artifacts are done
|
||||
|
||||
c. **If an artifact requires user input** (unclear context):
|
||||
- Use **AskUserQuestion tool** to clarify
|
||||
- Then continue with creation
|
||||
|
||||
5. **Show final status**
|
||||
```bash
|
||||
openspec status --change "<name>"
|
||||
```
|
||||
|
||||
**Output**
|
||||
|
||||
After completing all artifacts, summarize:
|
||||
- Change name and location
|
||||
- List of artifacts created with brief descriptions
|
||||
- What's ready: "All artifacts created! Ready for implementation."
|
||||
- Prompt: "Run `/opsx:apply` or ask me to implement to start working on the tasks."
|
||||
|
||||
**Artifact Creation Guidelines**
|
||||
|
||||
- Follow the `instruction` field from `openspec instructions` for each artifact type
|
||||
- The schema defines what each artifact should contain - follow it
|
||||
- Read dependency artifacts for context before creating new ones
|
||||
- Use `template` as the structure for your output file - fill in its sections
|
||||
- **IMPORTANT**: `context` and `rules` are constraints for YOU, not content for the file
|
||||
- Do NOT copy `<context>`, `<rules>`, `<project_context>` blocks into the artifact
|
||||
- These guide what you write, but should never appear in the output
|
||||
|
||||
**Guardrails**
|
||||
- Create ALL artifacts needed for implementation (as defined by schema's `apply.requires`)
|
||||
- Always read dependency artifacts before creating a new one
|
||||
- If context is critically unclear, ask the user - but prefer making reasonable decisions to keep momentum
|
||||
- If a change with that name already exists, ask if user wants to continue it or create a new one
|
||||
- Verify each artifact file exists after writing before proceeding to next
|
||||
902
PRD.md
Normal file
902
PRD.md
Normal file
@@ -0,0 +1,902 @@
|
||||
# SentryAgent.ai — Agent Identity Provider (AgentIdP)
|
||||
# Product Requirements Document (PRD)
|
||||
|
||||
**Company**: SentryAgent.ai
|
||||
**Product**: Free, Open Agent Identity Provider for Global AI Developers
|
||||
**Document Role**: Product Requirements Document (PRD) — this is the single source of truth for all product requirements, scope, and standards
|
||||
**Last Updated**: 2026-03-28
|
||||
**Status**: Active — Phase 1 MVP
|
||||
|
||||
> **See also**: [`README.md`](./README.md) — project orientation, team charter, and Claude session protocol
|
||||
|
||||
---
|
||||
|
||||
## 5. Project Scope
|
||||
|
||||
### 5.1 Phase 1: MVP (Weeks 1–8)
|
||||
|
||||
**Objective**: Prove the concept. Ship a production-ready AgentIdP.
|
||||
|
||||
#### In Scope ✅
|
||||
|
||||
| Feature | Owner | Priority |
|
||||
|---------|-------|----------|
|
||||
| Agent Registry Service (CRUD) | Principal Dev | P0 |
|
||||
| OAuth 2.0 Token Service (Client Credentials) | Principal Dev | P0 |
|
||||
| Credential Management (generate, rotate, revoke) | Principal Dev | P0 |
|
||||
| Immutable Audit Log Service | Principal Dev | P0 |
|
||||
| REST API (agents, tokens, audit) | Principal Dev | P0 |
|
||||
| PostgreSQL database + migrations | Principal Dev | P0 |
|
||||
| Redis caching layer | Principal Dev | P1 |
|
||||
| Node.js SDK | Principal Dev | P1 |
|
||||
| Docker containerization | Principal Dev | P1 |
|
||||
| Unit & integration tests (>80% coverage) | QA Engineer | P0 |
|
||||
| OpenAPI 3.0 documentation | Architect | P0 |
|
||||
| Docker Compose (local dev) | Principal Dev | P1 |
|
||||
| Deployment guide | Architect | P1 |
|
||||
| AGNTCY alignment documentation | Architect | P1 |
|
||||
|
||||
#### Out of Scope ❌ (Phase 2+)
|
||||
|
||||
| Feature | Phase |
|
||||
|---------|-------|
|
||||
| HashiCorp Vault integration | Phase 2 |
|
||||
| Multi-region deployment | Phase 2 |
|
||||
| Advanced policy engine (OPA) | Phase 2 |
|
||||
| Web dashboard UI | Phase 2 |
|
||||
| Python/Go/Java/Rust SDKs | Phase 2 |
|
||||
| Prometheus + Grafana monitoring | Phase 2 |
|
||||
| AGNTCY federation support | Phase 3 |
|
||||
| W3C DID support | Phase 3 |
|
||||
| Agent marketplace | Phase 3 |
|
||||
| SOC 2 certification | Phase 3 |
|
||||
|
||||
### 5.2 Phase 2: Production-Ready (Weeks 9–20)
|
||||
|
||||
- HashiCorp Vault for secret management
|
||||
- Multi-language SDKs (Python, Go, Java)
|
||||
- Advanced policy engine (OPA integration)
|
||||
- Web dashboard UI (React + TypeScript)
|
||||
- Prometheus + Grafana monitoring
|
||||
- Multi-region deployment (US, EU, APAC)
|
||||
- SOC 2 Type II certification process
|
||||
|
||||
### 5.3 Phase 3: Ecosystem & Standards (Weeks 21–36)
|
||||
|
||||
- AGNTCY federation support
|
||||
- W3C Decentralized Identifiers (DIDs)
|
||||
- Agent marketplace
|
||||
- Advanced compliance reporting
|
||||
- Enterprise tier features
|
||||
|
||||
---
|
||||
|
||||
## 6. Engineering Standards (Non-Negotiable)
|
||||
|
||||
### 6.1 DRY — Don't Repeat Yourself
|
||||
|
||||
**Rule**: Zero code duplication. Every piece of logic exists in exactly one place.
|
||||
|
||||
**Implementation**:
|
||||
|
||||
| Pattern | Location | Purpose |
|
||||
|---------|----------|---------|
|
||||
| Type definitions | `src/types/index.ts` | Single source of truth |
|
||||
| Crypto utilities | `src/utils/crypto.ts` | All crypto operations |
|
||||
| JWT utilities | `src/utils/jwt.ts` | All JWT operations |
|
||||
| Validation logic | `src/utils/validators.ts` | All input validation |
|
||||
| Error classes | `src/utils/errors.ts` | All custom errors |
|
||||
| DB queries | `src/services/` | All database access |
|
||||
| HTTP middleware | `src/middleware/` | All cross-cutting concerns |
|
||||
|
||||
**Enforcement**:
|
||||
- Virtual CTO reviews every PR for duplication
|
||||
- ESLint rules flag repeated patterns
|
||||
- No copy-paste code — ever
|
||||
|
||||
### 6.2 SOLID Principles
|
||||
|
||||
**S — Single Responsibility**:
|
||||
- `AgentService`: Agent CRUD only — nothing else
|
||||
- `OAuth2Service`: Token issuance only — nothing else
|
||||
- `CredentialService`: Credential management only — nothing else
|
||||
- `AuditService`: Audit logging only — nothing else
|
||||
|
||||
**O — Open/Closed**:
|
||||
- All services implement interfaces
|
||||
- New features extend, never modify existing code
|
||||
- Plugin architecture for credential backends
|
||||
|
||||
**L — Liskov Substitution**:
|
||||
- All service implementations are interchangeable
|
||||
- Consistent error handling across all services
|
||||
- Uniform response shapes across all endpoints
|
||||
|
||||
**I — Interface Segregation**:
|
||||
- Separate read/write interfaces where applicable
|
||||
- Minimal, focused interfaces — no fat interfaces
|
||||
- Controllers depend on service interfaces, not implementations
|
||||
|
||||
**D — Dependency Inversion**:
|
||||
- All dependencies injected via constructor
|
||||
- Services depend on abstractions (interfaces)
|
||||
- No direct instantiation of dependencies in business logic
|
||||
|
||||
### 6.3 OpenSpec Standards (Mandatory)
|
||||
|
||||
**Rule**: Every API endpoint MUST have an OpenAPI 3.0 specification
|
||||
BEFORE implementation begins. No exceptions.
|
||||
|
||||
**Process**:
|
||||
```
|
||||
1. Virtual Architect writes OpenAPI spec
|
||||
2. CEO reviews and approves
|
||||
3. Virtual Principal Developer implements
|
||||
4. Virtual QA Engineer verifies spec matches implementation
|
||||
5. Swagger UI auto-generated from spec
|
||||
```
|
||||
|
||||
**OpenAPI Spec Location**: `docs/openapi.yaml`
|
||||
|
||||
**Required for every endpoint**:
|
||||
- Summary and description
|
||||
- Request body schema (with validation rules)
|
||||
- Response schemas (all status codes)
|
||||
- Error response schemas
|
||||
- Authentication requirements
|
||||
- Example requests and responses
|
||||
|
||||
### 6.4 TypeScript Strict Mode (Mandatory)
|
||||
|
||||
**Rule**: TypeScript strict mode is always enabled. No `any` types. Ever.
|
||||
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"strict": true,
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictBindCallApply": true,
|
||||
"strictPropertyInitialization": true,
|
||||
"noImplicitThis": true,
|
||||
"alwaysStrict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 6.5 Code Documentation Standards
|
||||
|
||||
**JSDoc required for**:
|
||||
- All public classes
|
||||
- All public methods
|
||||
- All interfaces
|
||||
- All complex logic blocks
|
||||
|
||||
**Example**:
|
||||
```typescript
|
||||
/**
|
||||
* Creates a new AI agent identity in the SentryAgent.ai registry.
|
||||
* Assigns a unique immutable ID and provisions credentials.
|
||||
*
|
||||
* @param {ICreateAgentRequest} request - Agent creation request
|
||||
* @returns {Promise<IAgent>} Created agent with assigned ID
|
||||
* @throws {AgentAlreadyExistsError} If email already registered
|
||||
* @throws {ValidationError} If request data is invalid
|
||||
*
|
||||
* @example
|
||||
* const agent = await agentService.createAgent({
|
||||
* email: 'screener-001@sentryagent.ai',
|
||||
* agentType: 'screener',
|
||||
* version: 'v1.0.0',
|
||||
* capabilities: ['resume:read'],
|
||||
* owner: 'helloworld-team',
|
||||
* deploymentEnv: 'production'
|
||||
* });
|
||||
*/
|
||||
async createAgent(request: ICreateAgentRequest): Promise<IAgent>
|
||||
```
|
||||
|
||||
### 6.6 Error Handling Standards
|
||||
|
||||
**Rule**: All errors are explicit, typed, and handled. No silent failures.
|
||||
|
||||
```typescript
|
||||
// Custom error hierarchy
|
||||
class SentryAgentError extends Error {}
|
||||
class ValidationError extends SentryAgentError {}
|
||||
class AgentNotFoundError extends SentryAgentError {}
|
||||
class AgentAlreadyExistsError extends SentryAgentError {}
|
||||
class CredentialError extends SentryAgentError {}
|
||||
class AuthenticationError extends SentryAgentError {}
|
||||
class AuthorizationError extends SentryAgentError {}
|
||||
class RateLimitError extends SentryAgentError {}
|
||||
```
|
||||
|
||||
**All errors include**:
|
||||
- Error code (machine-readable)
|
||||
- Error message (human-readable)
|
||||
- HTTP status code
|
||||
- Stack trace (development only)
|
||||
|
||||
### 6.7 Git Standards
|
||||
|
||||
**Repository**: `https://git.sentryagent.ai/`
|
||||
|
||||
**Branch Strategy** (Git Flow):
|
||||
- `main`: Production-ready code only
|
||||
- `develop`: Integration branch for Phase work
|
||||
- `feature/*`: Individual features (e.g., `feature/agent-registry`)
|
||||
- `bugfix/*`: Bug fixes (e.g., `bugfix/token-validation`)
|
||||
- `release/*`: Release preparation (e.g., `release/v1.0.0`)
|
||||
|
||||
**Commit Standards** (Conventional Commits):
|
||||
```
|
||||
feat(agent): implement agent registry CRUD
|
||||
fix(oauth2): correct token expiration calculation
|
||||
docs(api): update OpenAPI spec for /agents endpoint
|
||||
test(credential): add rotation edge case tests
|
||||
chore(deps): upgrade TypeScript to 5.3.3
|
||||
```
|
||||
|
||||
**Pull Request Standards**:
|
||||
- [ ] Feature branch created from `develop`
|
||||
- [ ] OpenAPI spec updated (if API change)
|
||||
- [ ] Unit tests added (>80% coverage)
|
||||
- [ ] Integration tests added
|
||||
- [ ] JSDoc comments added
|
||||
- [ ] No code duplication (DRY check)
|
||||
- [ ] SOLID principles followed
|
||||
- [ ] Performance acceptable (<200ms)
|
||||
- [ ] Security review passed
|
||||
- [ ] Virtual CTO approval required
|
||||
- [ ] Virtual QA Engineer sign-off required
|
||||
- [ ] Merge to `develop` (squash commits)
|
||||
- [ ] Delete feature branch
|
||||
|
||||
---
|
||||
|
||||
## 7. Technology Stack
|
||||
|
||||
### 7.1 Runtime & Language
|
||||
|
||||
| Component | Version | Rationale |
|
||||
|-----------|---------|-----------|
|
||||
| Node.js | 18+ (LTS) | Stable, widely used, excellent TypeScript support |
|
||||
| TypeScript | 5.3+ | Strict mode, type safety, no `any` types |
|
||||
| npm | 9+ | Standard package manager |
|
||||
|
||||
### 7.2 Web Framework & Middleware
|
||||
|
||||
| Component | Version | Purpose |
|
||||
|-----------|---------|---------|
|
||||
| Express.js | 4.18+ | Lightweight, battle-tested web framework |
|
||||
| helmet | 7.1+ | Security headers (HSTS, CSP, etc.) |
|
||||
| cors | 2.8+ | CORS handling |
|
||||
| morgan | 1.10+ | HTTP request logging |
|
||||
| pino | 8.17+ | Structured JSON logging |
|
||||
| pino-http | 8.6+ | Express integration for Pino |
|
||||
|
||||
### 7.3 Database & Caching
|
||||
|
||||
| Component | Version | Purpose |
|
||||
|-----------|---------|---------|
|
||||
| PostgreSQL | 14+ | Primary database (ACID, reliability) |
|
||||
| pg | 8.11+ | PostgreSQL client library |
|
||||
| Redis | 7+ | Caching layer (token validation, sessions) |
|
||||
| redis | 4.6+ | Redis client library |
|
||||
|
||||
### 7.4 Authentication & Security
|
||||
|
||||
| Component | Version | Purpose |
|
||||
|-----------|---------|---------|
|
||||
| jsonwebtoken | 9.1+ | JWT signing and verification |
|
||||
| bcryptjs | 2.4+ | Password/secret hashing (10 salt rounds) |
|
||||
| uuid | 9.0+ | Unique ID generation |
|
||||
| crypto (Node.js built-in) | N/A | Cryptographic operations |
|
||||
| dotenv | 16.3+ | Environment variable management |
|
||||
|
||||
### 7.5 Testing
|
||||
|
||||
| Component | Version | Purpose |
|
||||
|-----------|---------|---------|
|
||||
| Jest | 29.7+ | Unit and integration testing |
|
||||
| @types/jest | 29.5+ | TypeScript types for Jest |
|
||||
| ts-jest | 29.1+ | Jest + TypeScript integration |
|
||||
| supertest | 6.3+ | HTTP endpoint testing |
|
||||
| @testing-library/node | Latest | Node.js testing utilities |
|
||||
|
||||
### 7.6 Code Quality & Linting
|
||||
|
||||
| Component | Version | Purpose |
|
||||
|-----------|---------|---------|
|
||||
| ESLint | 8.56+ | Code linting and style |
|
||||
| @typescript-eslint/parser | 6.17+ | TypeScript parsing for ESLint |
|
||||
| @typescript-eslint/eslint-plugin | 6.17+ | TypeScript-specific rules |
|
||||
| Prettier | 3.1+ | Code formatting |
|
||||
|
||||
### 7.7 Documentation & API
|
||||
|
||||
| Component | Version | Purpose |
|
||||
|-----------|---------|---------|
|
||||
| swagger-ui-express | 4.6+ | Interactive API documentation |
|
||||
| joi | 17.11+ | Schema validation |
|
||||
|
||||
### 7.8 Deployment & Containerization
|
||||
|
||||
| Component | Version | Purpose |
|
||||
|-----------|---------|---------|
|
||||
| Docker | 24+ | Container runtime |
|
||||
| Docker Compose | 2.20+ | Local development orchestration |
|
||||
| Alpine Linux | 3.18 | Minimal base image |
|
||||
|
||||
### 7.9 Validation & Schema
|
||||
|
||||
| Component | Version | Purpose |
|
||||
|-----------|---------|---------|
|
||||
| Joi | 17.11+ | Request/response schema validation |
|
||||
|
||||
---
|
||||
|
||||
## 8. Project Structure (DRY Compliance)
|
||||
|
||||
```
|
||||
sentryagent-idp/
|
||||
+-- src/
|
||||
¦ +-- config/
|
||||
¦ ¦ +-- env.ts # Environment variables
|
||||
¦ ¦ +-- database.ts # PostgreSQL connection pool
|
||||
¦ ¦ +-- redis.ts # Redis client
|
||||
¦ ¦ +-- logger.ts # Pino logger configuration
|
||||
¦ ¦
|
||||
¦ +-- types/
|
||||
¦ ¦ +-- index.ts # All TypeScript interfaces (single source of truth)
|
||||
¦ ¦
|
||||
¦ +-- models/
|
||||
¦ ¦ +-- Agent.ts # Agent entity
|
||||
¦ ¦ +-- Credential.ts # Credential entity
|
||||
¦ ¦ +-- AuditLog.ts # Audit log entity
|
||||
¦ ¦ +-- Token.ts # Token entity
|
||||
¦ ¦
|
||||
¦ +-- services/
|
||||
¦ ¦ +-- AgentService.ts # Agent CRUD (no duplication)
|
||||
¦ ¦ +-- OAuth2Service.ts # Token issuance (no duplication)
|
||||
¦ ¦ +-- CredentialService.ts # Credential management (no duplication)
|
||||
¦ ¦ +-- AuditService.ts # Audit logging (no duplication)
|
||||
¦ ¦ +-- TokenService.ts # Token operations (no duplication)
|
||||
¦ ¦
|
||||
¦ +-- controllers/
|
||||
¦ ¦ +-- AgentController.ts # Agent endpoints
|
||||
¦ ¦ +-- OAuth2Controller.ts # OAuth 2.0 endpoints
|
||||
¦ ¦ +-- HealthController.ts # Health check endpoint
|
||||
¦ ¦
|
||||
¦ +-- middleware/
|
||||
¦ ¦ +-- authentication.ts # Bearer token validation
|
||||
¦ ¦ +-- authorization.ts # Scope-based access control
|
||||
¦ ¦ +-- errorHandler.ts # Global error handling
|
||||
¦ ¦ +-- logging.ts # Request/response logging
|
||||
¦ ¦ +-- validation.ts # Request validation
|
||||
¦ ¦ +-- rateLimit.ts # Rate limiting
|
||||
¦ ¦
|
||||
¦ +-- utils/
|
||||
¦ ¦ +-- crypto.ts # Crypto utilities (hashing, secrets)
|
||||
¦ ¦ +-- jwt.ts # JWT utilities (sign, verify)
|
||||
¦ ¦ +-- validators.ts # Input validation (reusable)
|
||||
¦ ¦ +-- errors.ts # Custom error classes
|
||||
¦ ¦ +-- helpers.ts # General utilities
|
||||
¦ ¦
|
||||
¦ +-- routes/
|
||||
¦ ¦ +-- agents.ts # Agent routes
|
||||
¦ ¦ +-- oauth2.ts # OAuth 2.0 routes
|
||||
¦ ¦ +-- health.ts # Health routes
|
||||
¦ ¦
|
||||
¦ +-- migrations/
|
||||
¦ ¦ +-- 001_create_agents_table.sql
|
||||
¦ ¦ +-- 002_create_credentials_table.sql
|
||||
¦ ¦ +-- 003_create_audit_logs_table.sql
|
||||
¦ ¦
|
||||
¦ +-- app.ts # Express app setup
|
||||
¦ +-- server.ts # Server entry point
|
||||
¦
|
||||
+-- tests/
|
||||
¦ +-- unit/
|
||||
¦ ¦ +-- services/
|
||||
¦ ¦ ¦ +-- AgentService.test.ts
|
||||
¦ ¦ ¦ +-- OAuth2Service.test.ts
|
||||
¦ ¦ ¦ +-- CredentialService.test.ts
|
||||
¦ ¦ ¦ +-- AuditService.test.ts
|
||||
¦ ¦ +-- utils/
|
||||
¦ ¦ +-- crypto.test.ts
|
||||
¦ ¦ +-- jwt.test.ts
|
||||
¦ ¦ +-- validators.test.ts
|
||||
¦ ¦
|
||||
¦ +-- integration/
|
||||
¦ ¦ +-- api/
|
||||
¦ ¦ ¦ +-- agents.test.ts
|
||||
¦ ¦ ¦ +-- oauth2.test.ts
|
||||
¦ ¦ ¦ +-- health.test.ts
|
||||
¦ ¦ +-- database/
|
||||
¦ ¦ +-- migrations.test.ts
|
||||
¦ ¦
|
||||
¦ +-- fixtures/
|
||||
¦ +-- agents.json
|
||||
¦ +-- credentials.json
|
||||
¦ +-- auditLogs.json
|
||||
¦
|
||||
+-- docs/
|
||||
¦ +-- README.md # This file
|
||||
¦ +-- architecture.md # Architecture Decision Records
|
||||
¦ +-- openapi.yaml # OpenAPI 3.0 specification
|
||||
¦ +-- deployment.md # Deployment guide
|
||||
¦ +-- agntcy-alignment.md # AGNTCY compliance documentation
|
||||
¦ +-- api-guide.md # API usage guide
|
||||
¦ +-- contributing.md # Contribution guidelines
|
||||
¦
|
||||
+-- docker-compose.yml # Local development stack
|
||||
+-- Dockerfile # Production image
|
||||
+-- .dockerignore # Docker build exclusions
|
||||
+-- .env.example # Environment template
|
||||
+-- .env.test # Test environment
|
||||
+-- .gitignore # Git exclusions
|
||||
+-- .eslintrc.js # ESLint configuration
|
||||
+-- .prettierrc.json # Prettier configuration
|
||||
+-- tsconfig.json # TypeScript configuration
|
||||
+-- jest.config.js # Jest configuration
|
||||
+-- package.json # Dependencies and scripts
|
||||
+-- package-lock.json # Locked dependencies
|
||||
+-- CHANGELOG.md # Version history
|
||||
+-- LICENSE # Open source license (MIT)
|
||||
+-- README.md # Project README
|
||||
+-- PRD.md # Product Requirements Document (this file)
|
||||
```
|
||||
|
||||
**DRY Principles Applied**:
|
||||
- ✅ Single `types/index.ts` for all interfaces (no duplication)
|
||||
- ✅ Shared `utils/` for crypto, JWT, validation (no duplication)
|
||||
- ✅ Centralized error handling in middleware (no duplication)
|
||||
- ✅ Reusable service layer (no business logic in controllers)
|
||||
- ✅ Configuration centralized in `config/` (no duplication)
|
||||
- ✅ Database queries isolated in services (no duplication)
|
||||
|
||||
---
|
||||
|
||||
## 9. Development Workflow
|
||||
|
||||
### 9.1 Feature Development Process
|
||||
|
||||
**Step 1: Specification (Virtual Architect)**
|
||||
- Write Architecture Decision Record (ADR)
|
||||
- Define OpenAPI 3.0 specification
|
||||
- Specify database schema
|
||||
- List test cases
|
||||
- CEO approves specification
|
||||
|
||||
**Step 2: Implementation (Virtual Principal Developer)**
|
||||
- Create feature branch: `git checkout -b feature/agent-registry`
|
||||
- Implement per specification
|
||||
- Follow DRY and SOLID principles
|
||||
- Add JSDoc comments
|
||||
- Create unit tests (>80% coverage)
|
||||
- Push to `git.sentryagent.ai`
|
||||
|
||||
**Step 3: Code Review (Virtual CTO)**
|
||||
- Check compliance with standards
|
||||
- Verify DRY principles
|
||||
- Review test coverage
|
||||
- Verify SOLID principles
|
||||
- Approve or request changes
|
||||
|
||||
**Step 4: Testing (Virtual QA Engineer)**
|
||||
- Run integration tests
|
||||
- Test edge cases
|
||||
- Verify AGNTCY alignment
|
||||
- Verify OpenAPI spec matches implementation
|
||||
- Sign off on quality
|
||||
|
||||
**Step 5: Deployment (Virtual CTO)**
|
||||
- Merge to `develop` branch (squash commits)
|
||||
- Delete feature branch
|
||||
- Deploy to staging
|
||||
- Deploy to production
|
||||
|
||||
### 9.2 Git Workflow
|
||||
|
||||
```bash
|
||||
# Create feature branch from develop
|
||||
git checkout develop
|
||||
git pull origin develop
|
||||
git checkout -b feature/agent-registry
|
||||
|
||||
# Make changes, commit with conventional commits
|
||||
git add src/services/AgentService.ts
|
||||
git commit -m "feat(agent): implement agent registry CRUD"
|
||||
|
||||
# Push to repository
|
||||
git push origin feature/agent-registry
|
||||
|
||||
# Create pull request on git.sentryagent.ai
|
||||
# Virtual CTO reviews and approves
|
||||
# Virtual QA Engineer signs off
|
||||
|
||||
# Merge to develop (squash commits)
|
||||
git checkout develop
|
||||
git pull origin develop
|
||||
git merge --squash feature/agent-registry
|
||||
git commit -m "feat(agent): implement agent registry CRUD"
|
||||
git push origin develop
|
||||
|
||||
# Delete feature branch
|
||||
git branch -d feature/agent-registry
|
||||
git push origin --delete feature/agent-registry
|
||||
```
|
||||
|
||||
### 9.3 Code Review Checklist
|
||||
|
||||
Before any code is merged to `develop`, verify:
|
||||
|
||||
- [ ] TypeScript strict mode: `tsc --strict` passes
|
||||
- [ ] No `any` types used
|
||||
- [ ] No code duplication (DRY check)
|
||||
- [ ] SOLID principles applied
|
||||
- [ ] Unit tests included (>80% coverage)
|
||||
- [ ] Integration tests included
|
||||
- [ ] JSDoc comments present
|
||||
- [ ] Error handling implemented
|
||||
- [ ] No OWASP Top 10 vulnerabilities
|
||||
- [ ] Performance acceptable (<200ms)
|
||||
- [ ] Database migrations included
|
||||
- [ ] OpenAPI specification updated
|
||||
- [ ] Conventional commit message used
|
||||
- [ ] Virtual CTO approval obtained
|
||||
- [ ] Virtual QA Engineer sign-off obtained
|
||||
|
||||
---
|
||||
|
||||
## 10. OpenSpec Compliance
|
||||
|
||||
### 10.1 OpenAPI 3.0 Specification
|
||||
|
||||
**Location**: `docs/openapi.yaml`
|
||||
|
||||
**Mandatory for every endpoint**:
|
||||
- Summary and description
|
||||
- Request body schema (with validation rules)
|
||||
- Response schemas (all status codes)
|
||||
- Error response schemas
|
||||
- Authentication requirements
|
||||
- Example requests and responses
|
||||
|
||||
**Example OpenAPI Spec**:
|
||||
```yaml
|
||||
openapi: 3.0.0
|
||||
info:
|
||||
title: SentryAgent.ai Agent Identity Provider
|
||||
version: 1.0.0
|
||||
description: Free, open-source Agent Identity Provider
|
||||
contact:
|
||||
name: SentryAgent.ai
|
||||
url: https://sentryagent.ai
|
||||
|
||||
servers:
|
||||
- url: https://api.sentryagent.ai
|
||||
description: Production
|
||||
- url: http://localhost:3000
|
||||
description: Development
|
||||
|
||||
paths:
|
||||
/agents:
|
||||
post:
|
||||
summary: Create a new AI agent
|
||||
operationId: createAgent
|
||||
tags:
|
||||
- Agents
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CreateAgentRequest'
|
||||
responses:
|
||||
'201':
|
||||
description: Agent created successfully
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Agent'
|
||||
'400':
|
||||
description: Invalid request
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
'409':
|
||||
description: Agent already exists
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
|
||||
components:
|
||||
schemas:
|
||||
Agent:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
- email
|
||||
- agentType
|
||||
- version
|
||||
- capabilities
|
||||
- owner
|
||||
- deploymentEnv
|
||||
- status
|
||||
- createdAt
|
||||
- updatedAt
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
format: uuid
|
||||
description: Unique agent identifier
|
||||
email:
|
||||
type: string
|
||||
format: email
|
||||
description: Agent email (agent-type-001@sentryagent.ai)
|
||||
agentType:
|
||||
type: string
|
||||
description: AGNTCY agent type
|
||||
version:
|
||||
type: string
|
||||
description: Semantic version
|
||||
capabilities:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
description: Agent capabilities
|
||||
owner:
|
||||
type: string
|
||||
description: Developer or team name
|
||||
deploymentEnv:
|
||||
type: string
|
||||
enum: [development, staging, production]
|
||||
status:
|
||||
type: string
|
||||
enum: [active, suspended, revoked, archived]
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
updatedAt:
|
||||
type: string
|
||||
format: date-time
|
||||
|
||||
Error:
|
||||
type: object
|
||||
required:
|
||||
- code
|
||||
- message
|
||||
properties:
|
||||
code:
|
||||
type: string
|
||||
description: Error code
|
||||
message:
|
||||
type: string
|
||||
description: Error message
|
||||
details:
|
||||
type: object
|
||||
description: Additional error details
|
||||
```
|
||||
|
||||
### 10.2 AGNTCY Alignment
|
||||
|
||||
**Agent Identity Model** (AGNTCY-compliant):
|
||||
```typescript
|
||||
interface IAgent {
|
||||
id: string; // Unique agent ID (UUID) — immutable
|
||||
email: string; // agent-type-001@sentryagent.ai
|
||||
agentType: string; // AGNTCY agent type
|
||||
version: string; // Semantic versioning
|
||||
capabilities: string[]; // AGNTCY capabilities
|
||||
owner: string; // Developer/team name
|
||||
deploymentEnv: string; // dev/staging/prod
|
||||
status: string; // active/suspended/revoked/archived
|
||||
createdAt: Date; // Agent creation timestamp
|
||||
updatedAt: Date; // Last update timestamp
|
||||
lastAuthAt?: Date; // Last authentication timestamp
|
||||
metadata?: Record<string, unknown>; // AGNTCY metadata
|
||||
}
|
||||
```
|
||||
|
||||
**Audit Compliance**:
|
||||
- ✅ Immutable audit logs (no deletion, no modification)
|
||||
- ✅ All agent actions logged (creation, auth, revocation)
|
||||
- ✅ Timestamps in ISO 8601 format
|
||||
- ✅ Tamper-proof storage (PostgreSQL with constraints)
|
||||
- ✅ Retention policy (90 days free tier, configurable)
|
||||
|
||||
**Policy Enforcement**:
|
||||
- ✅ Least privilege by default
|
||||
- ✅ Capability-based access control
|
||||
- ✅ Revocation at scale
|
||||
- ✅ Credential rotation on schedule
|
||||
|
||||
---
|
||||
|
||||
## 11. Quality Gates & Metrics
|
||||
|
||||
### 11.1 Code Quality Standards
|
||||
|
||||
| Metric | Target | Tool | Enforcement |
|
||||
|--------|--------|------|-------------|
|
||||
| Test Coverage | >80% | Jest/nyc | Fail PR if <80% |
|
||||
| TypeScript Strict | 100% | tsc --strict | Fail build if violations |
|
||||
| Linting | 0 errors | ESLint | Fail PR if errors |
|
||||
| Code Duplication | <5% | Manual review | CTO rejects if >5% |
|
||||
| Security Scan | 0 high/critical | npm audit | Fail build if vulnerabilities |
|
||||
|
||||
### 11.2 Performance Standards
|
||||
|
||||
| Metric | Target | Measurement | Enforcement |
|
||||
|--------|--------|-------------|-------------|
|
||||
| Token Issuance | <100ms | Benchmark test | Fail if >100ms |
|
||||
| API Response | <200ms | Integration test | Fail if >200ms |
|
||||
| Database Query | <50ms | Query profiling | Fail if >50ms |
|
||||
| Cache Hit Rate | >90% | Redis monitoring | Monitor weekly |
|
||||
|
||||
### 11.3 Reliability Standards
|
||||
|
||||
| Metric | Target | Measurement |
|
||||
|--------|--------|-------------|
|
||||
| Uptime | 99.5% (Phase 2) | Monitoring dashboard |
|
||||
| Error Rate | <0.1% | Error tracking |
|
||||
| Recovery Time | <5 minutes | Runbook testing |
|
||||
|
||||
---
|
||||
|
||||
## 12. Deployment & Operations
|
||||
|
||||
### 12.1 Local Development Setup
|
||||
|
||||
```bash
|
||||
# Clone repository
|
||||
git clone https://git.sentryagent.ai/sentryagent-idp.git
|
||||
cd sentryagent-idp
|
||||
|
||||
# Install dependencies
|
||||
npm install
|
||||
|
||||
# Setup environment
|
||||
cp .env.example .env
|
||||
# Edit .env with local values
|
||||
|
||||
# Start services (PostgreSQL, Redis)
|
||||
docker-compose up -d
|
||||
|
||||
# Run database migrations
|
||||
npm run migrate
|
||||
|
||||
# Start development server
|
||||
npm run dev
|
||||
|
||||
# Server runs on http://localhost:3000
|
||||
# Swagger UI: http://localhost:3000/api-docs
|
||||
```
|
||||
|
||||
### 12.2 Docker Deployment
|
||||
|
||||
```bash
|
||||
# Build image
|
||||
docker build -t sentryagent-idp:1.0.0 .
|
||||
|
||||
# Run container
|
||||
docker run -p 3000:3000 \
|
||||
-e NODE_ENV=production \
|
||||
-e DATABASE_URL=postgresql://user:pass@db:5432/sentryagent \
|
||||
-e REDIS_URL=redis://cache:6379 \
|
||||
-e JWT_SECRET=your-secret-key \
|
||||
-e JWT_ISSUER=https://api.sentryagent.ai \
|
||||
sentryagent-idp:1.0.0
|
||||
```
|
||||
|
||||
### 12.3 Docker Compose (Local Development)
|
||||
|
||||
```yaml
|
||||
version: '3.9'
|
||||
|
||||
services:
|
||||
app:
|
||||
build: .
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
NODE_ENV: development
|
||||
DATABASE_URL: postgresql://sentryagent:sentryagent@postgres:5432/sentryagent_idp
|
||||
REDIS_URL: redis://redis:6379
|
||||
JWT_SECRET: dev-secret-key-change-in-production
|
||||
depends_on:
|
||||
- postgres
|
||||
- redis
|
||||
volumes:
|
||||
- ./src:/app/src
|
||||
command: npm run dev
|
||||
|
||||
postgres:
|
||||
image: postgres:15-alpine
|
||||
environment:
|
||||
POSTGRES_USER: sentryagent
|
||||
POSTGRES_PASSWORD: sentryagent
|
||||
POSTGRES_DB: sentryagent_idp
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
ports:
|
||||
- "6379:6379"
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
redis_data:
|
||||
```
|
||||
|
||||
### 12.4 Production Deployment Checklist
|
||||
|
||||
- [ ] Environment variables configured securely
|
||||
- [ ] Database backups enabled (daily)
|
||||
- [ ] SSL/TLS certificates installed
|
||||
- [ ] Rate limiting configured
|
||||
- [ ] Monitoring alerts set up
|
||||
- [ ] Logging aggregation enabled
|
||||
- [ ] Disaster recovery plan documented
|
||||
- [ ] Security audit completed
|
||||
- [ ] Load balancer configured
|
||||
- [ ] CDN configured (if applicable)
|
||||
- [ ] Health check endpoints verified
|
||||
- [ ] Rollback procedure documented
|
||||
|
||||
---
|
||||
|
||||
## 13. Risk Management
|
||||
|
||||
### 13.1 Technical Risks
|
||||
|
||||
| Risk | Probability | Impact | Mitigation |
|
||||
|------|-------------|--------|-----------|
|
||||
| Database performance degradation | Medium | High | Connection pooling, caching, indexing |
|
||||
| Token validation latency | Low | Medium | Redis cache, JWT caching |
|
||||
| Credential compromise | Low | Critical | Encryption, audit logs, rotation, monitoring |
|
||||
| API rate limiting bypass | Low | Medium | Token bucket algorithm, monitoring |
|
||||
| Data loss | Very Low | Critical | Daily backups, replication, disaster recovery |
|
||||
|
||||
### 13.2 Mitigation Strategies
|
||||
|
||||
- **Code Review**: Catch issues early (Virtual CTO)
|
||||
- **Testing**: >80% coverage (Virtual QA Engineer)
|
||||
- **Monitoring**: Real-time alerts (Phase 2)
|
||||
- **Documentation**: Clear runbooks for operations
|
||||
- **Backups**: Daily database snapshots
|
||||
- **Security**: Regular audits and penetration testing
|
||||
|
||||
---
|
||||
|
||||
## 14. Success Metrics & KPIs
|
||||
|
||||
### 14.1 Phase 1 MVP Success Criteria
|
||||
|
||||
**Technical**:
|
||||
- ✅ All features implemented and tested
|
||||
- ✅ >80% test coverage
|
||||
- ✅ Zero critical security issues
|
||||
- ✅ API response time <200ms
|
||||
- ✅ Token issuance <100ms
|
||||
- ✅ AGNTCY compliance verified
|
||||
|
||||
**Adoption**:
|
||||
- ✅ 50+ agents registered in first month
|
||||
- ✅ 10+ developers using the service
|
||||
- ✅ Positive feedback on ease of use
|
||||
Reference in New Issue
Block a user