abelworkflow 1.2.2 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,50 +1,170 @@
1
1
  ---
2
2
  name: abel-implement
3
- description: Implement an OpenSpec change with test-first Red, Green, Refactor cycles.
3
+ description: Implement approved changes with mandatory TDD.
4
4
  category: abel
5
5
  tags: [abel, implementation, TDD]
6
6
  argument-hint: [change_name]
7
7
  ---
8
8
 
9
9
  <!-- ABEL:START -->
10
- # abel-implement
10
+ **Arguments**
11
+ - Requested: `<change_name>`
11
12
 
12
- Implement one ready OpenSpec change with minimal, verified patches.
13
+ **Guardrails**
13
14
 
14
- ## Rules
15
+ - Keep changes tightly scoped to the requested outcome; enforce side-effect review before applying any modification.
16
+ - Minimize documentation—avoid unnecessary comments; prefer self-explanatory code.
17
+ - Refer to `openspec/AGENTS.md` (located inside the `openspec/` directory—run `ls openspec` or `openspec update` if you don't see it) for additional OpenSpec conventions or clarifications.
15
18
 
16
- - Follow the repository instructions and the Implement column of its Stage Skill Matrix.
17
- - Before any write, state assumptions and unknowns explicitly. If a critical unknown could change behavior, scope, architecture, or safety, stop and ask the user or return to `/abel-design --change <change-name>`.
18
- - Retrieve project context with `rg`, `rg --files`, `git grep`, and direct file reads.
19
- - Use unified diff patches and stay inside the task's declared scope. Do not invent missing product or architecture decisions.
19
+ **TDD Guardrails (mandatory)**
20
+ - **Red Phase**: Create or execute the task's failing executable verification ONLY; implementation code is FORBIDDEN.
21
+ - **Green Phase**: Write MINIMAL code to satisfy the verification; over-engineering is FORBIDDEN.
22
+ - **Refactor Phase**: Optimize code quality while keeping target and affected verification green and introducing no new full-suite failures.
23
+ - **Mandatory**: Run the task's executable verification after EVERY code change; never skip verification.
24
+ - **Test-First**: Each task MUST have a failing executable verification before implementation begins.
20
25
 
21
- ## Readiness
26
+ **Skill Integration**: See `Stage Skill Matrix` (Implement column)
22
27
 
23
- 1. Resolve `<change-name>` from the explicit argument; ask only if it is missing or ambiguous.
24
- 2. Run `openspec status --change <change-name> --json`. Read `schemaName`, `changeRoot`, `artifactPaths`, `applyRequires`, and artifact states; every required artifact must be done.
25
- 3. Inspect `openspec schema which <schemaName> --json`. Resolve its concrete `apply.tracks` file inside `changeRoot`; never guess a task filename.
26
- 4. Run `openspec validate <change-name> --strict --type change` and `openspec instructions apply --change <change-name> --json`.
27
- 5. Read the reported artifacts, tracking file, affected source, and nearby tests. Confirm that every task states scope, dependencies, Requirement/Scenario, Red failure, Green behavior, and verification commands.
28
- 6. Run the affected tests and full suite as a baseline. Record commands, exit status, and existing failure identities; an existing failure is not the target Red.
28
+ **Readiness Preflight (before any code or test write)**
29
29
 
30
- If readiness is incomplete or inconsistent, stop without product writes and return the issue to design.
30
+ 1. Explicit argument takes precedence. Resolve it directly; ask only when the argument is missing or cannot be resolved uniquely. Never require unconditional `openspec view` confirmation.
31
+ 2. Run `openspec status --change <change-name> --json`; read `schemaName`, `changeRoot`, `artifactPaths`, `applyRequires`, and `artifacts`.
32
+ 3. Run `openspec schema which <schemaName> --json`, read the resolved `schema.yaml`, and extract `apply.tracks`. Resolve `apply.tracks` relative to `changeRoot`; it must name one concrete existing regular file inside `changeRoot`. Missing, null, non-concrete, or escaping paths fail closed; do not infer the tracking path from apply-instruction `contextFiles` or `tasks`.
33
+ 4. Every artifact id in `applyRequires` must have status `done`; array presence or a general completion flag is insufficient.
34
+ 5. Run `openspec validate <change-name> --strict --type change`; require zero issues.
35
+ 6. Read every planning artifact reported by `artifactPaths`, then run `openspec instructions apply --change <change-name> --json` and follow the returned apply contract.
36
+ 7. Verify stable Requirement and Scenario references, the Requirement → Scenario → Verification → Task chain, and every task verification contract. Rebuild the Gate A and Gate B summaries; if approval cannot be proven in the current conversation, show the summaries and require explicit user confirmation.
37
+ 8. Run and record affected baseline tests and the full test suite before any write. Record each command, exit status, and normalized failure identities/reasons. Keep existing failures from the full suite separate from the target Red; an existing failure never counts as Red.
38
+ 9. If any preflight item fails, STOP and return `/abel-design --change <change-name>`. Do not invent or repair product, behavior, or architecture decisions here.
31
39
 
32
- ## TDD Cycle
40
+ **Tool Routing**:
41
+ - **TDD Cycle**: Autonomous refactoring
42
+ - **Final Review** (after all tasks):
43
+ - Backend refactor (subagents)
44
+ - Frontend refactor (subagents)
45
+ - **E2E tasks** → `/dev-browser`
33
46
 
34
- For each incomplete task, in dependency order:
47
+ After preflight, detect the project's verification tooling and work through the tracked tasks sequentially.
35
48
 
36
- 1. Red: add or update the smallest executable test or static check, then run it. It must fail for the target's expected reason before implementation changes. If it passes or fails for another reason, stop and resolve the mismatch.
37
- 2. Green: apply the minimal implementation patch and rerun the Red command until it passes.
38
- 3. Refactor: simplify only where useful, keeping the target and affected tests green after each code change.
39
- 4. Run the task's affected verification. Review the diff for unintended behavior, unrelated edits, security issues, and leaked runtime state.
40
- 5. Leave the task incomplete in `apply.tracks` until final verification succeeds.
49
+ **TDD Cycle (per task)**
41
50
 
42
- ## Final Verification
51
+ Consume these ordinary indented bullets from the task verification contract, never Markdown checkboxes:
52
+ - verification type: property | example | E2E | static
53
+ - Red command and expected failure reason
54
+ - Green expected behavior
55
+ - affected-suite command
56
+ - target scope/files
43
57
 
44
- - Run all target tests, affected suites, and the same full-suite baseline command. Require no new failure identities.
45
- - Rerun `openspec validate <change-name> --strict --type change` and inspect `openspec status --change <change-name> --json`.
46
- - Only after those checks pass, mark each implemented task complete in the file resolved from `apply.tracks`; require exactly one matching task ID. Rerun validation and status after this completion-only patch.
47
- - If any verification fails, ensure those tasks remain incomplete or restore them to incomplete so a resumed run selects them again.
48
- - Review the complete unified diff and report changed files, Red/Green evidence, final verification, baseline exceptions, and residual risks.
49
- - Do not archive automatically; `/opsx:archive` remains a separate user-authorized action.
58
+ - Red must fail because of the target defect described by the contract.
59
+ - If the failure reason differs or the command is invalid, STOP and return `/abel-design --change <change-name>`; do not improvise a replacement contract.
60
+ - A non-behavior-change task starts with its specified failing executable static verification.
61
+ - A manual-only task is not implementation-ready; STOP and return `/abel-design --change <change-name>`.
62
+
63
+ ```
64
+ ┌─────────────────────────────────────────────────────────┐
65
+ │ Step 1: 🔴 Red Phase - Execute Contract Verification │
66
+ │ ├─ Use the contract's verification type and scope │
67
+ │ ├─ Generate the required failing verification via │
68
+ │ │ PROMPT: "Generate failing verification for: {task}│
69
+ │ │ Context: {code_context} │
70
+ │ │ Output: unified diff patch │
71
+ │ │ FORBIDDEN: implementation code" │
72
+ │ ├─ Apply verification code (after review) │
73
+ │ ├─ Run Red command → MUST FAIL for expected reason │
74
+ │ └─ If it passes or fails differently → STOP │
75
+ ├─────────────────────────────────────────────────────────┤
76
+ │ Step 2: 🟢 Green Phase - Minimal Implementation │
77
+ │ ├─ Generate minimal implementation │
78
+ │ │ PROMPT: "Generate minimal code for verification: │
79
+ │ │ Verification: {verification_context} │
80
+ │ │ Context: {code_context} │
81
+ │ │ Output: unified diff patch │
82
+ │ │ FORBIDDEN: over-engineering" │
83
+ │ ├─ Apply implementation (after review & rewrite) │
84
+ │ ├─ Run Red command → MUST PASS │
85
+ │ └─ If fails → analyze error, fix, retry │
86
+ ├─────────────────────────────────────────────────────────┤
87
+ │ Step 3: 🔵 Refactor Phase │
88
+ │ ├─ Analyzes code quality │
89
+ │ ├─ Apply standard refactoring techniques: │
90
+ │ │ ├─ Eliminate code duplication │
91
+ │ │ ├─ Improve naming and structure │
92
+ │ │ ├─ Enhance readability │
93
+ │ │ └─ Simplify logic where possible │
94
+ │ ├─ Apply refactoring changes │
95
+ │ ├─ Run affected-suite command → MUST STILL PASS │
96
+ │ └─ If fails → rollback refactoring │
97
+ └─────────────────────────────────────────────────────────┘
98
+ ```
99
+
100
+ Before applying any change, perform mandatory side-effect review.
101
+
102
+ After a task's TDD cycle completes, locate the task ID's checkbox in the concrete tracking file resolved from schema `apply.tracks`; require exactly one match and update only it. Zero or multiple matches must STOP and return `/abel-design --change <change-name>`. Never hardcode an artifact filename or infer the tracking path from apply instructions.
103
+
104
+ **Final Review & Refactor** (after all tasks complete)
105
+
106
+ 1. Require all target tests to be green, then run the affected suites.
107
+ 2. Re-run the same full-suite command (the full test suite), compare normalized failure identities with the recorded full-suite baseline, and require no new failures.
108
+
109
+ 3. Execute global code review via subagents:
110
+
111
+ 4. Wait for background tasks to complete; review diff patches.
112
+ 5. Rewrite patches into production-grade code (per rewriting principle).
113
+ 6. Apply refactoring changes.
114
+ 7. Re-run target, affected, and full-suite verification against the baseline.
115
+ 8. If a target test fails or the full suite has a new failure, analyze the root cause and fix or roll back.
116
+ 9. Perform final side-effect review.
117
+ 10. Report that the change is ready for archive; do not archive until the user explicitly authorizes `/opsx:archive`.
118
+
119
+ **TDD Output Format**
120
+
121
+ ```
122
+ ## /abel-implement (TDD Mode)
123
+
124
+ ### Task 1/N: {task_description}
125
+
126
+ 🔴 Red Phase
127
+ ├─ Type: {verification_type}
128
+ ├─ Generated: {verification_files_or_none}
129
+ ├─ Run: {red_command}
130
+ └─ Result: failed for {expected_failure_reason} ✓
131
+
132
+ 🟢 Green Phase
133
+ ├─ Generated: {implementation_files}
134
+ ├─ Run: {red_command}
135
+ └─ Result: {green_expected_behavior} ✓
136
+
137
+ 🔵 Refactor Phase (Agent autonomous)
138
+ ├─ Optimized: {description}
139
+ ├─ Run: {affected_suite_command}
140
+ └─ Result: target verification green ✓
141
+
142
+ ✓ Task complete → Next task
143
+
144
+ ---
145
+
146
+ ### All Tasks Complete
147
+
148
+ 🔍 Final Review & Refactor
149
+
150
+ Backend Review
151
+ ├─ Files: {backend_files}
152
+ ├─ Status: Running in background...
153
+ └─ Task ID: {task_id}
154
+
155
+ Frontend Review
156
+ ├─ Files: {frontend_files}
157
+ ├─ Status: Running in background...
158
+ └─ Task ID: {task_id}
159
+
160
+ [Waiting for completion...]
161
+
162
+ ✓ Reviews complete
163
+ ├─ Applied: {refactoring_summary}
164
+ ├─ Target tests: green ✓
165
+ ├─ Full suite: no failures beyond baseline ✓
166
+ └─ Ready for user-authorized archive
167
+
168
+ ✓ Implementation complete
169
+ ```
50
170
  <!-- ABEL:END -->
@@ -14,7 +14,7 @@ tags: [openspec, init, setup]
14
14
  **Steps**
15
15
  1. Detect OS and adapt command style (Unix/PowerShell).
16
16
  2. Verify `openspec` availability via `openspec --version`.
17
- 3. If missing, stop and report `npm install -g @fission-ai/openspec` as manual remediation; do not run it automatically.
17
+ 3. If missing, install globally with `bun add --global @fission-ai/openspec@latest` when `bun --version` succeeds; otherwise use `npm install -g @fission-ai/openspec@latest`, then re-check version.
18
18
  4. Run `openspec init` (or `openspec update` for existing projects).
19
19
  5. Verify required skills:
20
20
  - Skills: `/dev-browser` `/context7-auto-research` `/grok-search`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abelworkflow",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "Install AbelWorkflow into ~/.agents and create Claude, Codex, and Pi links.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -39,8 +39,6 @@
39
39
  "skills/grok-search/requirements.txt",
40
40
  "skills/grok-search/scripts/_dotenv.py",
41
41
  "skills/grok-search/scripts/groksearch_cli.py",
42
- "skills/prompt-enhancer/SKILL.md",
43
- "skills/prompt-enhancer/TEMPLATE.md",
44
42
  "skills/time/SKILL.md",
45
43
  "skills/time/scripts/time_cli.py"
46
44
  ],
@@ -1,40 +0,0 @@
1
- import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
-
3
- type JsonRecord = Record<string, unknown>;
4
-
5
- const MODEL_ID = "MBZUAI-IFM/K2-Think-v2";
6
-
7
- function isRecord(value: unknown): value is JsonRecord {
8
- return !!value && typeof value === "object" && !Array.isArray(value);
9
- }
10
-
11
- function normalizeTextContent(content: unknown): unknown {
12
- if (!Array.isArray(content)) return content;
13
- if (
14
- !content.every(
15
- (part) =>
16
- isRecord(part) &&
17
- part.type === "text" &&
18
- typeof part.text === "string",
19
- )
20
- ) {
21
- return content;
22
- }
23
-
24
- return content.map((part) => part.text).join("");
25
- }
26
-
27
- export default function (pi: ExtensionAPI) {
28
- pi.on("before_provider_request", (event, ctx) => {
29
- if (ctx.model?.provider !== "ifm" || ctx.model.id !== MODEL_ID) return;
30
- if (!isRecord(event.payload) || !Array.isArray(event.payload.messages)) return;
31
-
32
- return {
33
- ...event.payload,
34
- messages: event.payload.messages.map((message) => {
35
- if (!isRecord(message)) return message;
36
- return { ...message, content: normalizeTextContent(message.content) };
37
- }),
38
- };
39
- });
40
- }
@@ -1,24 +0,0 @@
1
- ---
2
- name: prompt-enhancer
3
- description: |
4
- Rewrite a raw prompt into a clearer prompt for a coding agent. Use only when the user explicitly asks to improve, optimize, rewrite, or structure a prompt for Codex, Claude Code, Gemini CLI, or another AI agent. Triggers: "improve this prompt", "rewrite this prompt", "optimize this prompt for Codex", "make this prompt better for an AI agent".
5
- ---
6
-
7
- # Prompt Enhancer
8
-
9
- Rewrite raw prompts into concise, structured prompts for coding agents.
10
-
11
- ## Use When
12
-
13
- - The input itself is a prompt or instruction for an AI agent.
14
- - The user explicitly asks to improve, optimize, or rewrite that prompt.
15
- - The target is a coding agent such as Codex, Claude Code, or Gemini CLI.
16
-
17
- Do not use this for general writing edits like email, docs, or PR copy.
18
-
19
- ## Do
20
-
21
- - Rewrite the prompt directly with the current agent, following the structure from [TEMPLATE.md](TEMPLATE.md).
22
- - Preserve the user's intent and explicit constraints.
23
- - Add structure and missing execution context only when it helps the agent act.
24
- - Use placeholders for unknown context instead of inventing new requirements.
@@ -1,87 +0,0 @@
1
- # Prompt Enhancement Template
2
-
3
- This is the system prompt used to enhance user prompts.
4
-
5
- ## System Role
6
-
7
- You are an expert Prompt Engineer for Coding Agents (Claude Code, Codex, Gemini CLI).
8
- Your goal is to rewrite the user's raw input into a structured, high-context prompt that maximizes the agent's effectiveness.
9
-
10
- ## Guidelines
11
-
12
- 1. **Structure**: Use a clear Markdown structure with headers.
13
- 2. **Chain of Thought**: Explicitly ask the agent to "Think step-by-step" or "Analyze the file structure first".
14
- 3. **Context**: If the user's prompt is vague, add placeholders like "[Insert relevant file(s)]" or "[Specify tech stack]" in the rewritten prompt, or simply infer them if obvious.
15
- 4. **Format**:
16
- - **Context**: What is the current state? What files are involved?
17
- - **Objective**: What exactly should be done?
18
- - **Constraints**: specific libraries, coding styles, or "no placeholders".
19
- - **Response Format**: e.g., "Return only the code block" or "Explain step-by-step".
20
-
21
- ## Output Template
22
-
23
- ```markdown
24
- # Context
25
- [Refined context description]
26
-
27
- # Objective
28
- [Precise task definition]
29
-
30
- # Step-by-Step Instructions
31
- 1. [Step 1]
32
- 2. [Step 2]
33
- ...
34
-
35
- # Constraints
36
- - [Constraint 1]
37
- - [Constraint 2]
38
- ```
39
-
40
- ## Examples
41
-
42
- ### Example 1: Vague Input
43
-
44
- **Input:** "Write a login component"
45
-
46
- **Enhanced Output:**
47
- ```markdown
48
- # Context
49
- Building a React application. Need secure authentication UI component.
50
-
51
- # Objective
52
- Create a functional Login component with form validation.
53
-
54
- # Step-by-Step Instructions
55
- 1. Create LoginForm component with email/password fields
56
- 2. Add client-side validation (email format, password min length)
57
- 3. Handle form submission with loading state
58
- 4. Display error messages for failed attempts
59
- 5. Provide success callback for navigation
60
-
61
- # Constraints
62
- - Use controlled components for form inputs
63
- - Follow accessibility best practices (ARIA labels, focus management)
64
- - Handle both validation errors and API errors distinctly
65
- ```
66
-
67
- ### Example 2: Ambiguous Bug Fix
68
-
69
- **Input:** "fix the sorting bug"
70
-
71
- **Enhanced Output:**
72
- ```markdown
73
- # Context
74
- There is a reported bug related to sorting functionality. Need to investigate and fix.
75
-
76
- # Objective
77
- Identify and fix the sorting bug in the codebase.
78
-
79
- # Step-by-Step Instructions
80
- 1. First, identify files containing sorting logic (search for "sort", "order", "compare")
81
- 2. Review the sorting implementation and identify the issue
82
- 3. Check edge cases: empty arrays, single items, duplicate values
83
- 4. Implement the fix with proper type handling
84
- 5. Add or update tests to cover the bug scenario
85
-
86
- # Constraints
87
- ```