abelworkflow 1.2.3 → 1.3.0
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.
- package/README.md +26 -25
- package/extensions/gpt-responses-compat.ts +166 -27
- package/lib/cli/main.mjs +18 -86
- package/lib/cli/pi.mjs +43 -0
- package/lib/cli/prompts.mjs +3 -3
- package/lib/installer/assets.mjs +35 -31
- package/lib/installer/install.mjs +29 -9
- package/lib/installer/links.mjs +97 -84
- package/lib/paths.mjs +0 -2
- package/lib/providers/claude.mjs +14 -3
- package/lib/providers/codex.mjs +14 -9
- package/lib/providers/pi.mjs +61 -68
- package/lib/providers/skills.mjs +22 -22
- package/lib/providers/url.mjs +32 -1
- package/lib/templates/codex/agents/default.toml +16 -54
- package/lib/templates/codex/agents/explorer.toml +25 -52
- package/lib/templates/codex/agents/planner.toml +23 -77
- package/lib/templates/codex/agents/reviewer.toml +16 -62
- package/lib/templates/codex/agents/worker.toml +30 -64
- package/lib/templates/codex/config-base.toml +0 -6
- package/lib/templates/{workflow/gitignore.template → gitignore.template} +0 -3
- package/lib/tools/cli-installer.mjs +40 -12
- package/package.json +13 -18
- package/lib/templates/workflow/AGENTS.md +0 -50
- package/lib/templates/workflow/commands/abel-design.md +0 -175
- package/lib/templates/workflow/commands/abel-diagnose.md +0 -63
- package/lib/templates/workflow/commands/abel-implement.md +0 -170
- package/lib/templates/workflow/commands/abel-init.md +0 -25
- package/skills/dev-browser/SKILL.md +0 -281
- package/skills/dev-browser/dist/scripts/start.d.ts +0 -1
- package/skills/dev-browser/dist/scripts/start.js +0 -90
- package/skills/dev-browser/dist/src/client.d.ts +0 -92
- package/skills/dev-browser/dist/src/client.js +0 -310
- package/skills/dev-browser/dist/src/entrypoint.d.ts +0 -29
- package/skills/dev-browser/dist/src/entrypoint.js +0 -113
- package/skills/dev-browser/dist/src/index.d.ts +0 -3
- package/skills/dev-browser/dist/src/index.js +0 -1
- package/skills/dev-browser/dist/src/page-api.d.ts +0 -24
- package/skills/dev-browser/dist/src/page-api.js +0 -103
- package/skills/dev-browser/dist/src/relay.d.ts +0 -26
- package/skills/dev-browser/dist/src/relay.js +0 -567
- package/skills/dev-browser/dist/src/runtime.d.ts +0 -34
- package/skills/dev-browser/dist/src/runtime.js +0 -44
- package/skills/dev-browser/dist/src/snapshot/browser-script.d.ts +0 -22
- package/skills/dev-browser/dist/src/snapshot/browser-script.js +0 -868
- package/skills/dev-browser/dist/src/snapshot/index.d.ts +0 -13
- package/skills/dev-browser/dist/src/snapshot/index.js +0 -13
- package/skills/dev-browser/dist/src/snapshot/inject.d.ts +0 -12
- package/skills/dev-browser/dist/src/snapshot/inject.js +0 -12
- package/skills/dev-browser/dist/src/standalone.d.ts +0 -31
- package/skills/dev-browser/dist/src/standalone.js +0 -173
- package/skills/dev-browser/dist/src/startup.d.ts +0 -46
- package/skills/dev-browser/dist/src/startup.js +0 -77
- package/skills/dev-browser/dist/src/target-registry.d.ts +0 -28
- package/skills/dev-browser/dist/src/target-registry.js +0 -134
- package/skills/dev-browser/dist/src/types.d.ts +0 -26
- package/skills/dev-browser/dist/src/types.js +0 -1
- package/skills/dev-browser/package-lock.json +0 -1545
- package/skills/dev-browser/package.json +0 -35
- package/skills/dev-browser/references/scraping.md +0 -144
- package/skills/git-commit/SKILL.md +0 -124
- package/skills/time/SKILL.md +0 -119
- package/skills/time/scripts/time_cli.py +0 -143
|
@@ -3,72 +3,38 @@
|
|
|
3
3
|
|
|
4
4
|
name = "worker"
|
|
5
5
|
description = """
|
|
6
|
-
Dispatch for bounded
|
|
7
|
-
|
|
6
|
+
Dispatch for bounded diff authoring: Red verifications, Green implementations,
|
|
7
|
+
and optional intra-module refactors within an explicitly assigned write set.
|
|
8
|
+
The parent applies and verifies every returned diff.
|
|
8
9
|
Do NOT dispatch when the task touches global configs, shared utilities,
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
public interfaces used across modules, or project scaffolding without an
|
|
11
|
+
approved expanded contract.
|
|
11
12
|
"""
|
|
12
13
|
nickname_candidates = ["Forge", "Patch", "Builder"]
|
|
13
14
|
model = "gpt-5.6-luna"
|
|
14
|
-
model_reasoning_effort = "
|
|
15
|
-
sandbox_mode = "
|
|
16
|
-
|
|
17
|
-
developer_instructions = """
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
## Prohibited (stop and report instead)
|
|
40
|
-
|
|
41
|
-
Any of the following requires escalation — do not attempt alone:
|
|
42
|
-
- Shared utility modules, infrastructure layers, or framework-level code
|
|
43
|
-
- Global configs, global state, or global constants
|
|
44
|
-
- Project initialization, scaffolding, or directory restructuring
|
|
45
|
-
- New dependencies consumed by more than one module
|
|
46
|
-
- Public interfaces or abstractions referenced across multiple modules
|
|
47
|
-
|
|
48
|
-
Decision rule: if the blast radius exceeds the current module boundary,
|
|
49
|
-
it is a global task — stop immediately.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
## Execution Standards
|
|
53
|
-
|
|
54
|
-
1. Read before writing — understand relevant code before editing.
|
|
55
|
-
2. Smallest defensible change — no speculative improvements.
|
|
56
|
-
3. TDD when behavior changes — tests before or alongside implementation.
|
|
57
|
-
4. Verify, don't claim — never say "fixed" without running verification;
|
|
58
|
-
if you cannot verify, say so explicitly.
|
|
59
|
-
|
|
60
|
-
## Output
|
|
61
|
-
|
|
62
|
-
Normal completion → Completion Report:
|
|
63
|
-
1. Modified files: <path> — <what changed and why>
|
|
64
|
-
|
|
65
|
-
2. Verification: <command> → <result, or "unverified: <reason>">
|
|
66
|
-
3. Residual risk: <notes for orchestrator, or "none">
|
|
67
|
-
|
|
68
|
-
Mid-task block → Handover Report (stop first, then write):
|
|
69
|
-
1. Completed changes: <file> — <specific changes made>
|
|
70
|
-
2. Unfinished parts: <steps not yet executed>
|
|
71
|
-
3. Blocking reason: <what global capability is needed>
|
|
72
|
-
|
|
73
|
-
4. Continuation suggestion: <how the orchestrator should proceed>
|
|
15
|
+
model_reasoning_effort = "max"
|
|
16
|
+
sandbox_mode = "read-only"
|
|
17
|
+
|
|
18
|
+
developer_instructions = """Author bounded unified diffs for the parent orchestrator.
|
|
19
|
+
- Work only on the explicitly assigned task, paths/symbols, and approved behavior.
|
|
20
|
+
- Never write to the worktree, apply a patch, edit AGENTS indexes/OpenSpec tracking files, commit, spawn subagents, or advance task state.
|
|
21
|
+
- Do not broaden a write set, add dependencies, change public/shared infrastructure, or invent behavior/architecture. Stop and report a blocker when the contract is insufficient.
|
|
22
|
+
- Preserve unrelated user changes and base the diff on the supplied current baseline.
|
|
23
|
+
|
|
24
|
+
TDD handoff:
|
|
25
|
+
- Red: return only the approved failing test/static-verification diff and its expected target failure.
|
|
26
|
+
- Green: after the parent confirms Red, return only the minimum implementation diff.
|
|
27
|
+
- Refactor: after the parent confirms Green, return only an optional in-scope cleanup diff.
|
|
28
|
+
- If the parent reports a verification failure, return a bounded correction diff or a blocker; do not silently change the contract.
|
|
29
|
+
|
|
30
|
+
Return valid JSON only:
|
|
31
|
+
{
|
|
32
|
+
"phase": "<red|green|refactor|blocked>",
|
|
33
|
+
"task_id": "<id>",
|
|
34
|
+
"modified_files": ["<path>"],
|
|
35
|
+
"diff": "<unified diff or empty string>",
|
|
36
|
+
"verification": [{"command": "<command>", "expected_or_observed": "<result>"}],
|
|
37
|
+
"residual_risk": ["<risk>"],
|
|
38
|
+
"blocked_by": ["<reason>"]
|
|
39
|
+
}
|
|
74
40
|
"""
|
|
@@ -13,12 +13,6 @@ value.
|
|
|
13
13
|
- An active workflow command takes precedence over this default orchestration
|
|
14
14
|
policy. Follow its phase rules, write boundaries, required tools,
|
|
15
15
|
verification order, and stop/go gates exactly.
|
|
16
|
-
- `/abel-design` is design-only: investigate and produce validated OpenSpec
|
|
17
|
-
artifacts without implementing product code.
|
|
18
|
-
- `/abel-implement` requires OpenSpec readiness and test-first Red, Green,
|
|
19
|
-
Refactor cycles before completion is recorded.
|
|
20
|
-
- `/abel-diagnose` requires reproduction and evidence for the root cause before
|
|
21
|
-
a regression test and minimal fix.
|
|
22
16
|
- Subagents assist inside the active phase. They never own workflow transitions
|
|
23
17
|
or bypass required user confirmation.
|
|
24
18
|
|
|
@@ -26,7 +26,28 @@ async function runCommand(command, args) {
|
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
function
|
|
29
|
+
async function installCadence(run = runCommand) {
|
|
30
|
+
await run("pi", ["install", "npm:@abelxiaoxing/cadence"]);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function detectPackageManager(exists = commandExists) {
|
|
34
|
+
if (exists("bun")) return "bun";
|
|
35
|
+
if (exists("npm")) return "npm";
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function buildCliToolInstallCommand({ packageManager = "npm", packageName, skipScripts = false }) {
|
|
40
|
+
if (packageManager === "bun") {
|
|
41
|
+
return {
|
|
42
|
+
command: "bun",
|
|
43
|
+
args: [
|
|
44
|
+
"add",
|
|
45
|
+
"-g",
|
|
46
|
+
...(skipScripts ? ["--ignore-scripts"] : []),
|
|
47
|
+
packageName
|
|
48
|
+
]
|
|
49
|
+
};
|
|
50
|
+
}
|
|
30
51
|
return {
|
|
31
52
|
command: "npm",
|
|
32
53
|
args: [
|
|
@@ -52,7 +73,9 @@ function getNpmInstallHelp(platform = getPlatform()) {
|
|
|
52
73
|
};
|
|
53
74
|
}
|
|
54
75
|
|
|
55
|
-
async function installCliTool(tool, { confirmOrCancel }) {
|
|
76
|
+
async function installCliTool(tool, { confirmOrCancel }, runtime = {}) {
|
|
77
|
+
const exists = runtime.commandExists ?? commandExists;
|
|
78
|
+
const run = runtime.runCommand ?? runCommand;
|
|
56
79
|
const toolConfig = {
|
|
57
80
|
claude: {
|
|
58
81
|
label: "Claude Code",
|
|
@@ -74,16 +97,18 @@ async function installCliTool(tool, { confirmOrCancel }) {
|
|
|
74
97
|
|
|
75
98
|
if (!toolConfig) throw new Error(`Unsupported tool: ${tool}`);
|
|
76
99
|
|
|
77
|
-
|
|
100
|
+
const packageManager = detectPackageManager(exists);
|
|
101
|
+
if (!packageManager) {
|
|
78
102
|
const help = getNpmInstallHelp();
|
|
79
|
-
p.log.warn(`未检测到 npm,无法安装 ${toolConfig.label}。`);
|
|
80
|
-
p.log.message(
|
|
103
|
+
p.log.warn(`未检测到 bun 或 npm,无法安装 ${toolConfig.label}。`);
|
|
104
|
+
p.log.message(`推荐先安装 Bun: https://bun.sh/install`);
|
|
105
|
+
p.log.message(`${help.platformLabel} 也可先安装 Node.js/npm,再重新运行安装。`);
|
|
81
106
|
p.log.message(`中国大陆镜像: ${help.mainlandUrl}`);
|
|
82
107
|
p.log.message(`官方下载页: ${help.officialUrl}`);
|
|
83
|
-
return;
|
|
108
|
+
return false;
|
|
84
109
|
}
|
|
85
110
|
|
|
86
|
-
const installed =
|
|
111
|
+
const installed = exists(toolConfig.command);
|
|
87
112
|
if (installed) {
|
|
88
113
|
const shouldUpdate = await confirmOrCancel({
|
|
89
114
|
message: `${toolConfig.label} 已检测到,是否继续安装/更新?`,
|
|
@@ -91,16 +116,17 @@ async function installCliTool(tool, { confirmOrCancel }) {
|
|
|
91
116
|
});
|
|
92
117
|
if (!shouldUpdate) {
|
|
93
118
|
p.log.message(`跳过 ${toolConfig.label} 安装。`);
|
|
94
|
-
return;
|
|
119
|
+
return false;
|
|
95
120
|
}
|
|
96
121
|
}
|
|
97
122
|
|
|
98
|
-
const installCommand = buildCliToolInstallCommand(toolConfig);
|
|
99
|
-
const spinner = p.spinner();
|
|
100
|
-
spinner.start(`正在使用
|
|
123
|
+
const installCommand = buildCliToolInstallCommand({ ...toolConfig, packageManager });
|
|
124
|
+
const spinner = (runtime.spinner ?? p.spinner)();
|
|
125
|
+
spinner.start(`正在使用 ${packageManager} 安装 ${toolConfig.label}...`);
|
|
101
126
|
try {
|
|
102
|
-
await
|
|
127
|
+
await run(installCommand.command, installCommand.args);
|
|
103
128
|
spinner.stop(`${toolConfig.label} 安装完成`);
|
|
129
|
+
return true;
|
|
104
130
|
} catch (error) {
|
|
105
131
|
spinner.cancel(c.red(`${toolConfig.label} 安装失败: ${error.message}`));
|
|
106
132
|
throw error;
|
|
@@ -109,8 +135,10 @@ async function installCliTool(tool, { confirmOrCancel }) {
|
|
|
109
135
|
|
|
110
136
|
export {
|
|
111
137
|
buildCliToolInstallCommand,
|
|
138
|
+
detectPackageManager,
|
|
112
139
|
getNpmInstallHelp,
|
|
113
140
|
getRunCommandSpawnOptions,
|
|
114
141
|
installCliTool,
|
|
142
|
+
installCadence,
|
|
115
143
|
commandExists
|
|
116
144
|
};
|
package/package.json
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "abelworkflow",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Install AbelWorkflow into ~/.agents and
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "Install AbelWorkflow into ~/.agents and configure Claude, Codex, and Pi.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "npm run
|
|
7
|
+
"test": "npm run test:node",
|
|
8
8
|
"test:node": "node --test test/*.test.mjs",
|
|
9
9
|
"test:python": "python -B -m unittest discover -s test",
|
|
10
|
-
"test:dev-browser": "npm test --prefix skills/dev-browser",
|
|
11
10
|
"test:contracts": "node --test test/runtime-doc-contracts.test.mjs test/cli-args.test.mjs",
|
|
12
|
-
"typecheck": "npm run typecheck
|
|
13
|
-
"
|
|
14
|
-
"prepack": "npm run build",
|
|
11
|
+
"typecheck": "npm run typecheck:pi",
|
|
12
|
+
"typecheck:pi": "tsc -p tsconfig.pi.json",
|
|
15
13
|
"check:docs": "node --test test/docs-contracts.test.mjs test/runtime-doc-contracts.test.mjs",
|
|
16
|
-
"check:package": "
|
|
17
|
-
"check": "npm run
|
|
14
|
+
"check:package": "node --test test/package-contents.test.mjs",
|
|
15
|
+
"check": "npm run test:node && npm run test:python && npm run typecheck"
|
|
18
16
|
},
|
|
19
17
|
"bin": {
|
|
20
18
|
"abelworkflow": "bin/abelworkflow.mjs"
|
|
@@ -27,26 +25,23 @@
|
|
|
27
25
|
"skills/context7-auto-research/.env.example",
|
|
28
26
|
"skills/context7-auto-research/SKILL.md",
|
|
29
27
|
"skills/context7-auto-research/context7-api.cjs",
|
|
30
|
-
"skills/dev-browser/SKILL.md",
|
|
31
|
-
"skills/dev-browser/dist",
|
|
32
|
-
"skills/dev-browser/package-lock.json",
|
|
33
|
-
"skills/dev-browser/package.json",
|
|
34
|
-
"skills/dev-browser/references",
|
|
35
|
-
"skills/git-commit/SKILL.md",
|
|
36
28
|
"skills/grok-search/.env.example",
|
|
37
29
|
"skills/grok-search/SKILL.md",
|
|
38
30
|
"skills/grok-search/defaults.json",
|
|
39
31
|
"skills/grok-search/requirements.txt",
|
|
40
32
|
"skills/grok-search/scripts/_dotenv.py",
|
|
41
|
-
"skills/grok-search/scripts/groksearch_cli.py"
|
|
42
|
-
"skills/time/SKILL.md",
|
|
43
|
-
"skills/time/scripts/time_cli.py"
|
|
33
|
+
"skills/grok-search/scripts/groksearch_cli.py"
|
|
44
34
|
],
|
|
45
35
|
"engines": {
|
|
46
36
|
"node": ">=22"
|
|
47
37
|
},
|
|
48
38
|
"packageManager": "npm@10.9.2",
|
|
49
39
|
"license": "MIT",
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@earendil-works/pi-coding-agent": "0.85.1",
|
|
42
|
+
"@types/node": "22.20.1",
|
|
43
|
+
"typescript": "5.9.3"
|
|
44
|
+
},
|
|
50
45
|
"dependencies": {
|
|
51
46
|
"@clack/prompts": "^1.2.0",
|
|
52
47
|
"picocolors": "^1.1.1",
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# Configuration
|
|
2
|
-
|
|
3
|
-
## Language
|
|
4
|
-
|
|
5
|
-
- Tool/model interactions: **English**
|
|
6
|
-
- User-facing output: **Chinese**
|
|
7
|
-
|
|
8
|
-
## Code Style
|
|
9
|
-
|
|
10
|
-
- Concise, efficient, no redundancy
|
|
11
|
-
- Minimal comments/docs (only when necessary)
|
|
12
|
-
- Targeted changes only; never touch unrelated functionality
|
|
13
|
-
|
|
14
|
-
## Development Context
|
|
15
|
-
|
|
16
|
-
Development context: work is currently in the development phase, and this is a development repository.
|
|
17
|
-
Do not retain runtime user state in the repository or shipped artifacts, and do not preserve compatibility layers for unreleased behavior.
|
|
18
|
-
Prefer deleting obsolete code paths; keep code and prompts concise and avoid over-engineering.
|
|
19
|
-
This context does not by itself authorize destructive changes to user files or credentials outside the repository.
|
|
20
|
-
|
|
21
|
-
## Context Rules
|
|
22
|
-
|
|
23
|
-
- Use local codebase retrieval with `rg`, `rg --files`, `git grep`, and direct file reads.
|
|
24
|
-
- Rely only on project code plus `grok/context7` results
|
|
25
|
-
- If information is insufficient or uncertain, state it explicitly
|
|
26
|
-
|
|
27
|
-
## Workflow
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
/abel-init → /abel-design → /abel-implement(TDD)
|
|
31
|
-
↘ /abel-diagnose (bug fix)
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## Universal Constraints
|
|
35
|
-
|
|
36
|
-
1. Use `unified diff patch` format for proposed/applied changes
|
|
37
|
-
2. Before applying changes, state assumptions and unknowns explicitly; stop and ask the user on any critical unknown
|
|
38
|
-
|
|
39
|
-
## Stage Skill Matrix
|
|
40
|
-
|
|
41
|
-
| Skill | Design | Implement | Diagnose | Capability & Triggers |
|
|
42
|
-
| --- | :---: | :---: | :---: | --- |
|
|
43
|
-
| /grok-search | ✅ | ❌ | ✅ | Deep research, concept understanding. Trigger: architectural patterns, best practices |
|
|
44
|
-
| /context7-auto-research | ✅ | ✅ | ✅ | Official docs retrieval. Trigger: framework/library usage, APIs |
|
|
45
|
-
| /dev-browser | ○ | ✅ | ✅ | Browser automation. Trigger: E2E testing, UI verification |
|
|
46
|
-
| /time | ○ | ✅ | ○ | Time/timezone operations. Trigger: scheduling logic |
|
|
47
|
-
|
|
48
|
-
Legend: ✅ Primary, ○ Optional, ❌ Forbidden
|
|
49
|
-
|
|
50
|
-
OpenSpec commands: `/opsx:propose` `/opsx:explore` `/opsx:apply` `/opsx:update` `/opsx:sync` `/opsx:archive` `openspec view` `openspec status`
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: abel-design
|
|
3
|
-
description: Transform requirements into implementation-ready, traceable specs via gated clarification.
|
|
4
|
-
category: abel
|
|
5
|
-
tags: [abel, design, constraints, PBT, subagents]
|
|
6
|
-
argument-hint: [requirement | --change <change_name>]
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
<!-- ABEL:START -->
|
|
10
|
-
|
|
11
|
-
# abel-design — Gated Design Mode (Specs Only, No Implementation)
|
|
12
|
-
|
|
13
|
-
## Non-Negotiable Rules (Highest Priority)
|
|
14
|
-
1. DESIGN MODE ONLY — you MUST NOT generate implementation code.
|
|
15
|
-
2. WRITE SCOPE:
|
|
16
|
-
- Before Gate A: strictly read-only; persist nothing.
|
|
17
|
-
- After Gate A: write ONLY inside the resolved `changeRoot`. Create only ready artifacts; edit a done artifact only when an approved loop-back/consistency repair explicitly targets it.
|
|
18
|
-
3. NEVER assume or guess — every blocking decision goes to the user (see Decision Model).
|
|
19
|
-
4. Final output: a schema-valid, fully traceable OpenSpec change with BLOCKING_DECISIONS = 0, READY_TO_IMPLEMENT.
|
|
20
|
-
|
|
21
|
-
**Skill Integration**: See `Stage Skill Matrix` (Design column)
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## Decision Model
|
|
26
|
-
- Maintain an in-session Decision Ledger with: `id`, `class`, `question`, `evidence`, `options`, `recommendation`, `resolution`, `status`, `affected_artifacts`.
|
|
27
|
-
- `BLOCKING_DECISIONS` is the count of unresolved, non-mechanical decisions in that ledger.
|
|
28
|
-
- Behavior decisions answer WHAT: observable outcomes, scope/non-goals, scenarios, failure behavior, data/security/privacy/compatibility policies and success criteria.
|
|
29
|
-
- Technical decisions answer HOW: interfaces, data flow, dependencies, storage/algorithms, implementation error mechanisms and key technical parameters.
|
|
30
|
-
- MUST be approved by the user: goal, scope, non-goals and observable success behavior; data, security, privacy, compatibility and migration rules; new dependencies, cross-module architecture, irreversible changes; any technical choice with substantive trade-offs, including key parameters.
|
|
31
|
-
- MAY be decided mechanically by the agent: naming, file locations and local structure uniquely determined by existing repo conventions; easily reversible details with no external behavior change; test placement and execution order derived directly from the approved design.
|
|
32
|
-
- Record mechanical decisions and never re-ask them. Two or more viable options with substantive differences → escalate to a blocking decision.
|
|
33
|
-
- Do NOT create a runtime ledger or approval-state file. Materialize approved decisions only in schema artifacts.
|
|
34
|
-
|
|
35
|
-
## Phase 0 — Entry, Mode & Readiness (read-only)
|
|
36
|
-
- Verify an initialized OpenSpec root and the required CLI capabilities: `new change`, `list --json`, `schemas --json`, `schema which --json`, `schema validate --json`, `templates --json`, `status --json`, `instructions --json`, and `validate --strict`. If unavailable, STOP with actionable `/abel-init` remediation; do not initialize or update from this command.
|
|
37
|
-
- Resolve mode:
|
|
38
|
-
- Explicit `--change <name>` → Resume. If that change does not exist, STOP and ask the user to correct the name or choose New mode.
|
|
39
|
-
- Otherwise, an exact existing-change match → Resume.
|
|
40
|
-
- Otherwise → New mode; do not silently interpret an explicit/resume-like typo as a requirement.
|
|
41
|
-
- Resolve the effective schema by precedence: explicit schema choice, existing change metadata, project config, then `spec-driven`; verify it appears in `openspec schemas --json`.
|
|
42
|
-
- Before creating a change, run `openspec schema which <schema> --json` and `openspec schema validate <schema> --json`, inspect its definition and `openspec templates --schema <schema> --json`, and perform a preliminary behavior/technical/mixed dependency check. Implementation compatibility also requires a non-empty concrete `apply.tracks` that matches exactly one artifact's `generates`. An incompatible schema must fail closed before creation.
|
|
43
|
-
- New mode minimum intake before ANY exploration:
|
|
44
|
-
- Problem/goal statement, AND
|
|
45
|
-
- Scope anchor (which module/directory is involved).
|
|
46
|
-
- If either intake item is missing, ask the user concisely before proceeding.
|
|
47
|
-
- Generate a provisional kebab-case change name and check `openspec list --changes --json`. Recompute and confirm it from the final Gate A scope before creation. Persist nothing yet.
|
|
48
|
-
|
|
49
|
-
## Phase 1 — Evidence Exploration (read-only)
|
|
50
|
-
- Use local codebase retrieval with `rg`, `rg --files`, `git grep`, and direct file reads.
|
|
51
|
-
- Single context boundary → main agent explores directly.
|
|
52
|
-
- Multiple independent context boundaries, when the platform permits → dispatch parallel Explore subagents:
|
|
53
|
-
- Divide by context boundary (NOT functional role); each boundary self-contained.
|
|
54
|
-
- Each subagent receives: mandatory use of the codebase retrieval policy, a clear scope, and the mandatory JSON output schema:
|
|
55
|
-
{
|
|
56
|
-
"module_name": "所探索的上下文边界",
|
|
57
|
-
"existing_structures": ["关键结构/模式"],
|
|
58
|
-
"existing_conventions": ["约定/标准"],
|
|
59
|
-
"constraints_discovered": ["硬约束"],
|
|
60
|
-
"open_questions": ["需用户输入的歧义"],
|
|
61
|
-
"dependencies": ["跨模块依赖"],
|
|
62
|
-
"risks": ["风险/阻碍"],
|
|
63
|
-
"success_criteria_hints": ["可观察的成功行为"]
|
|
64
|
-
}
|
|
65
|
-
- Validate every subagent JSON before aggregation; aggregate constraints, dependencies, risks, conflicts and questions into the Decision Ledger.
|
|
66
|
-
- Audit existing codebase patterns:
|
|
67
|
-
Use `rg`, `rg --files`, `git grep`, and direct file reads to validate against existing codebase patterns.
|
|
68
|
-
- On-demand /context7-auto-research: verify candidate libraries/APIs against official contracts.
|
|
69
|
-
- On-demand /grok-search: architectural patterns and best practices for candidate directions.
|
|
70
|
-
- PBT boundary screening: probe empty input, idempotency, ordering, size/value bounds, state-transition legality → feed the question list for Phase 2.
|
|
71
|
-
- Reference: Inspect codebase structure with `rg --files`, `git grep`, and direct file reads.
|
|
72
|
-
|
|
73
|
-
## Phase 2 — Behavior Clarification Loop (multiple rounds allowed)
|
|
74
|
-
- Cover WHAT only: goal, scope, non-goals, observable scenarios/success criteria, failure behavior, and data/security/privacy/compatibility policies.
|
|
75
|
-
- Do not choose libraries, protocols, algorithms, storage, topology or implementation parameters in this phase; route them to Phase 4.
|
|
76
|
-
- Each round asks ONLY the current highest-impact blocking questions, grouped concisely, each with evidence, impact and a recommended default.
|
|
77
|
-
- Anti-patterns (flag and reject):
|
|
78
|
-
- Observable behavior deferred to implementation ("error behavior decided while coding")
|
|
79
|
-
- Technical mechanisms smuggled in as product requirements
|
|
80
|
-
- Target behavior patterns:
|
|
81
|
-
- "Lock the account for 30 minutes after 5 consecutive failed logins."
|
|
82
|
-
- "Retain audit records for 30 days and never expose secrets in responses."
|
|
83
|
-
- "For an empty query, return an empty result within the approved latency bound."
|
|
84
|
-
- An answer that widens modules, scenarios or data boundaries → return to Phase 1 for INCREMENTAL exploration only.
|
|
85
|
-
- Loop until unresolved behavior decisions = 0.
|
|
86
|
-
|
|
87
|
-
## ⛔ Gate A — Approve Behavior Contract
|
|
88
|
-
- Present the behavior contract and affected Decision Ledger entries; the user explicitly approves goal, scope/non-goals, scenarios/success criteria and policies.
|
|
89
|
-
- Recompute the change name from the approved scope and recheck duplicates.
|
|
90
|
-
- New mode: ONLY NOW create the change with `openspec new change <change-name>` (add `--schema <schema>` only for an explicit non-default choice).
|
|
91
|
-
- Build the Artifact Plan, then materialize only behavior-class artifacts that are safe and ready.
|
|
92
|
-
|
|
93
|
-
## Artifact Plan & Write Protocol
|
|
94
|
-
- Before New-mode creation, build a preliminary compatibility map from the resolved schema definition/templates. After creation or in Resume mode, build the final Artifact Plan from `status --json` and available `instructions --json`. Record the schema's `apply.tracks`; for every artifact record capture id/output paths, dependencies/status, substantive decision class (`behavior|technical|mixed`), write Gate, and affected decisions. Mechanical impact information alone does not make an artifact mixed.
|
|
95
|
-
- Classify by the decisions the artifact carries, never by a hardcoded artifact name:
|
|
96
|
-
- behavior → Gate A
|
|
97
|
-
- technical or mixed → Gate B
|
|
98
|
-
- behavior depending on a Gate B artifact → defer until after Gate B and then follow the DAG
|
|
99
|
-
- If the schema requires a write before Gate A, a write outside `changeRoot`, or an unapproved technical decision to unlock behavior, STOP before New-mode creation and ask the user to select a compatible schema/mapping. Schema order never overrides decision approval.
|
|
100
|
-
- Mandatory loop for EVERY artifact write:
|
|
101
|
-
1. Run `openspec status --change <change-name> --json`; verify `schemaName`, `changeRoot`, `artifactPaths`, status/dependencies and `applyRequires`. `existingOutputPaths` may be empty and is not a new-file target.
|
|
102
|
-
2. Run `openspec instructions <artifact-id> --change <change-name> --json`; follow its template/rules/dependencies.
|
|
103
|
-
3. Read dependencies and existing outputs; check consistency in both directions.
|
|
104
|
-
4. Prepare content in memory and show the decision summary or unified diff before the corresponding Gate. If materialization reveals a new substantive decision, return to the relevant loop and re-approve it.
|
|
105
|
-
5. After Gate approval, create exactly one ready artifact, or edit one done artifact explicitly targeted by an approved loop-back/consistency repair. Rerun status after every write and process newly unlocked artifacts topologically.
|
|
106
|
-
|
|
107
|
-
## Phase 3 — Technical Derivation
|
|
108
|
-
- Derive the technical design from the Gate A contract, existing codebase patterns and official API contracts.
|
|
109
|
-
- Mechanical decisions → record directly in the design. Substantive trade-offs → Phase 4.
|
|
110
|
-
|
|
111
|
-
## Phase 4 — Technical Decision & Verification Loop
|
|
112
|
-
- Cover HOW: interfaces, data flow, implementation error mechanisms, dependencies/algorithms and key parameters. Examples include JWT vs session design and an approved bcrypt cost factor.
|
|
113
|
-
- Apply the same evidence/options/recommendation format to every substantive technical decision; update the Decision Ledger.
|
|
114
|
-
- PBT applicability rule (screen with the six categories: commutativity/associativity, idempotency, round-trip, invariant preservation, monotonicity, bounds):
|
|
115
|
-
- Behavior with invariants, round-trips, idempotency, ordering, bounds or state transitions → MUST extract a property + falsification strategy.
|
|
116
|
-
- Behavior unsuited to PBT → use example/E2E/static verification and record why PBT does not apply. Do NOT force every requirement through every category.
|
|
117
|
-
- Give every scenario a stable reference: `<spec-path>#<requirement-heading>/<scenario-heading>` and require those headings to be unique within the spec; maintain Requirement → Scenario → Verification → Task.
|
|
118
|
-
- Every task has exactly one schema checkbox and a verification contract using ordinary indented bullets, NEVER nested `- [ ]`/`- [x]` lines:
|
|
119
|
-
- Task ID / dependencies
|
|
120
|
-
- Requirement + stable Scenario reference
|
|
121
|
-
- Verification type: property | example | E2E | static
|
|
122
|
-
- Red command + expected failure reason
|
|
123
|
-
- Green expected behavior
|
|
124
|
-
- Affected-suite verification command
|
|
125
|
-
- Target scope/files
|
|
126
|
-
- For a non-behavior-change task, the Red command is a pre-change executable static verification. Manual-only verification is not implementation-ready and MUST NOT pass Gate B or Exit; reshape the task until it has executable property/example/E2E/static verification.
|
|
127
|
-
- Loop until unresolved technical decisions = 0; prepare proposed remaining artifact contents/unified diffs in memory.
|
|
128
|
-
|
|
129
|
-
## ⛔ Gate B — Approve Implementation Contract
|
|
130
|
-
- Verify Phase 3/4 faithfully expand the Gate A contract; no unapproved new decisions introduced.
|
|
131
|
-
- Present substantive technical decisions, task/verification mapping and artifact materialization preview.
|
|
132
|
-
- The user explicitly approves that implementation contract.
|
|
133
|
-
- Write the remaining ready artifacts one at a time per the Artifact Plan & Write Protocol.
|
|
134
|
-
|
|
135
|
-
## Loop-Back Rules
|
|
136
|
-
- A user answer widens modules, scenarios or data boundaries → return to Phase 1.
|
|
137
|
-
- Technical analysis overturns the behavior contract → return to Phase 2; re-approve ONLY the affected decisions and synchronize all affected artifacts.
|
|
138
|
-
- Gate B finds the materialization unfaithful → return to Phase 3/4; unaffected Gate A decisions remain approved.
|
|
139
|
-
- Strict validation, verification-contract or traceability failure → return to the earliest phase that introduced the inconsistency.
|
|
140
|
-
- Never hide a late-discovered blocking question.
|
|
141
|
-
|
|
142
|
-
## Resume Rules
|
|
143
|
-
- Never infer user approval from artifact existence: `status` reporting `done` proves file completion only, not Gate approval.
|
|
144
|
-
- Never resume by fixed file names or file existence alone; the active schema decides.
|
|
145
|
-
- Algorithm:
|
|
146
|
-
1. Run `openspec status --change <change-name> --json`.
|
|
147
|
-
2. Use its `schemaName`, `changeRoot`, `artifactPaths` and statuses; read all `existingOutputPaths` and dependencies.
|
|
148
|
-
3. Check `openspec validate <change-name> --strict --type change`, template completeness, cross-artifact consistency, traceability and verification contracts.
|
|
149
|
-
4. Rebuild Gate A/B summaries and the Artifact Plan. Re-confirm every Gate approval that cannot be proven in the current conversation.
|
|
150
|
-
5. Choose the next step:
|
|
151
|
-
- Explicit Resume change not found (`change_error`) → STOP for spelling/New-mode confirmation; never create silently.
|
|
152
|
-
- Artifacts incomplete → repair/confirm the nearest safe Gate, then handle the artifacts the schema reports ready.
|
|
153
|
-
- Artifacts complete but validation/traceability fails → earliest inconsistent phase.
|
|
154
|
-
- Every artifact id listed in `applyRequires` is `done` → re-confirm any unproven Gate, then run the Exit audit.
|
|
155
|
-
- Only in-session, un-persisted analysis exists → no mid-loop resume; re-run the read-only analysis.
|
|
156
|
-
- Do NOT create runtime approval-state files; re-confirming the Gate summary IS the resume mechanism.
|
|
157
|
-
|
|
158
|
-
## Exit Criteria
|
|
159
|
-
- [ ] `openspec validate <change-name> --strict --type change` returns zero issues
|
|
160
|
-
- [ ] Every artifact id in `applyRequires` has status `done`
|
|
161
|
-
- [ ] Schema `apply.tracks` resolves to the generated task artifact inside `changeRoot`
|
|
162
|
-
- [ ] Artifacts are consistent and traceable; every task has a valid verification contract
|
|
163
|
-
- [ ] Every task has executable property/example/E2E/static verification; no task is manual-only
|
|
164
|
-
- [ ] BLOCKING_DECISIONS = 0
|
|
165
|
-
- [ ] User has explicitly approved the reconstructed/current Gate A and Gate B summaries in this conversation
|
|
166
|
-
- [ ] Status: READY_TO_IMPLEMENT
|
|
167
|
-
|
|
168
|
-
## Reference
|
|
169
|
-
- `openspec context --json` / `openspec schemas --json`
|
|
170
|
-
- `openspec view` / `openspec list --changes --json` / `openspec list --specs` (conflicts with existing specs)
|
|
171
|
-
- `openspec status --change <change-name> --json` / `openspec instructions <artifact-id> --change <change-name> --json`
|
|
172
|
-
- `openspec new change <change-name>` (Gate A only)
|
|
173
|
-
- `openspec show <change-name> --json --deltas-only` when validation fails
|
|
174
|
-
- `rg -n "Constraint:|MUST|MUST NOT|INVARIANT:|PROPERTY:" openspec/` before defining new ones
|
|
175
|
-
<!-- ABEL:END -->
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: abel-diagnose
|
|
3
|
-
description: Parallel diagnosis with batch fix reporting via systematic root cause analysis.
|
|
4
|
-
category: abel
|
|
5
|
-
tags: [abel, diagnosis, bugfix]
|
|
6
|
-
argument-hint: <problem-description>
|
|
7
|
-
---
|
|
8
|
-
<!-- ABEL:START -->
|
|
9
|
-
**Arguments**
|
|
10
|
-
- Required: `<problem-description>` (one or more bug descriptions; comma-separated supported)
|
|
11
|
-
|
|
12
|
-
**Guardrails**
|
|
13
|
-
- Root cause first; never fix symptoms only
|
|
14
|
-
- Verify root cause hypothesis with evidence before fix
|
|
15
|
-
- Only fixes with evidence-verified root cause may be applied
|
|
16
|
-
- Every fix must include a regression test
|
|
17
|
-
- Keep changes minimal and scoped
|
|
18
|
-
- If verification fails, rollback and iterate
|
|
19
|
-
|
|
20
|
-
**Execution Model**
|
|
21
|
-
- Run detection and root-cause analysis for all issues in parallel
|
|
22
|
-
- Infer scope automatically from problem text, traces, and retrieved code context
|
|
23
|
-
- Build dependency/conflict order before any fix application
|
|
24
|
-
- Same file: force sequential fix order; same symbol: merge when compatible, otherwise sequential
|
|
25
|
-
- Independent scopes: parallel-safe
|
|
26
|
-
- Fix generation for READY issues runs fully in parallel via subagents with forked/minimal context; main agent only aggregates and resolves conflicts
|
|
27
|
-
- Patch application and final verification must run strictly sequential by dependency order
|
|
28
|
-
- Always output one consolidated batch report
|
|
29
|
-
|
|
30
|
-
**Skill Integration**: See `Stage Skill Matrix` (Diagnose column)
|
|
31
|
-
|
|
32
|
-
**Steps**
|
|
33
|
-
1. Parse input, infer scope, and split into issue list (single or multiple).
|
|
34
|
-
2. For each issue in parallel: collect logs/traces and locate code via the configured codebase retrieval policy.
|
|
35
|
-
3. For each issue in parallel: perform root cause analysis; for multi-component chains, decompose the failure chain step by step with evidence.
|
|
36
|
-
4. Build dependency/conflict graph across issues and compute safe fix order.
|
|
37
|
-
5. Verify each issue's root cause against collected evidence; only issues with a verified root cause can move to fix generation.
|
|
38
|
-
6. Spawn one subagent per READY issue to generate `unified diff patch` and regression test with minimal scoped context.
|
|
39
|
-
7. Main agent reviews/merges subagent outputs by dependency order and outputs one batch report with all issue statuses and patches.
|
|
40
|
-
8. Apply merged patches strictly sequentially by dependency order.
|
|
41
|
-
9. Run final verification strictly sequentially by the same dependency order and output verification matrix.
|
|
42
|
-
|
|
43
|
-
**Batch Output**
|
|
44
|
-
```text
|
|
45
|
-
## /abel-diagnose Batch Report
|
|
46
|
-
|
|
47
|
-
### Batch Summary
|
|
48
|
-
Total: {n} | ReadyToFix: {n_ready} | Blocked: {n_blocked}
|
|
49
|
-
|
|
50
|
-
### Issue Results
|
|
51
|
-
- [{id}] Classification: {category}/{severity} | Root Cause: {summary} | Verified: {yes|no} | Subagent: {agent_id|none} | Status: {READY|BLOCKED}
|
|
52
|
-
|
|
53
|
-
### Patch Queue (dependency order)
|
|
54
|
-
1. [{id}] [subagent:{agent_id}] {file_list}
|
|
55
|
-
{unified_diff_patch}
|
|
56
|
-
|
|
57
|
-
### Verification Matrix
|
|
58
|
-
- [{id}] Regression: {passed|failed} | Affected Suite: {passed|failed}
|
|
59
|
-
|
|
60
|
-
### Final Status
|
|
61
|
-
{FIXED|PARTIAL|NEEDS_REVIEW|BLOCKED}
|
|
62
|
-
```
|
|
63
|
-
<!-- ABEL:END -->
|