@haaaiawd/anws 2.3.0 → 2.4.1
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 +1 -1
- package/bin/cli.js +53 -23
- package/lib/diff.js +5 -2
- package/lib/init.js +217 -96
- package/lib/install-state.js +18 -3
- package/lib/manifest.js +364 -79
- package/lib/prompt.js +68 -0
- package/lib/resources/index.js +36 -2
- package/lib/update.js +12 -6
- package/package.json +48 -47
- package/templates/.agents/skills/anws-system/SKILL.md +107 -105
- package/templates/.agents/skills/code-reviewer/SKILL.md +171 -115
- package/templates/.agents/skills/concept-modeler/SKILL.md +230 -179
- package/templates/.agents/skills/craft-authoring/SKILL.md +186 -183
- package/templates/.agents/skills/craft-authoring/references/BUNDLE_POLICY.md +42 -0
- package/templates/.agents/skills/design-reviewer/SKILL.md +265 -190
- package/templates/.agents/skills/e2e-testing-guide/SKILL.md +246 -135
- package/templates/.agents/skills/nexus-mapper/SKILL.md +321 -321
- package/templates/.agents/skills/nexus-mapper/references/probe-protocol.md +1 -1
- package/templates/.agents/skills/nexus-query/SKILL.md +1 -1
- package/templates/.agents/skills/output-contract/SKILL.md +37 -0
- package/templates/.agents/skills/runtime-inspector/SKILL.md +150 -99
- package/templates/.agents/skills/sequential-thinking/SKILL.md +222 -225
- package/templates/.agents/skills/spec-writer/SKILL.md +75 -30
- package/templates/.agents/skills/system-architect/SKILL.md +538 -678
- package/templates/.agents/skills/system-designer/SKILL.md +124 -537
- package/templates/.agents/skills/task-planner/SKILL.md +1 -2
- package/templates/.agents/skills/task-planner/references/TASK_TEMPLATE_05A.md +2 -2
- package/templates/.agents/skills/task-reviewer/SKILL.md +421 -386
- package/templates/.agents/skills/tech-evaluator/SKILL.md +252 -144
- package/templates/.agents/workflows/blueprint.md +156 -68
- package/templates/.agents/workflows/challenge.md +322 -494
- package/templates/.agents/workflows/change.md +182 -339
- package/templates/.agents/workflows/craft.md +159 -197
- package/templates/.agents/workflows/design-system.md +202 -674
- package/templates/.agents/workflows/explore.md +187 -399
- package/templates/.agents/workflows/forge.md +650 -609
- package/templates/.agents/workflows/genesis.md +438 -351
- package/templates/.agents/workflows/probe.md +215 -240
- package/templates/.agents/workflows/quickstart.md +304 -123
- package/templates/.agents/workflows/upgrade.md +145 -182
- package/templates_en/.agents/skills/anws-system/SKILL.md +110 -0
- package/templates_en/.agents/skills/code-reviewer/SKILL.md +171 -0
- package/templates_en/.agents/skills/concept-modeler/SKILL.md +230 -0
- package/templates_en/.agents/skills/craft-authoring/SKILL.md +179 -0
- package/templates_en/.agents/skills/craft-authoring/references/BUNDLE_POLICY.md +42 -0
- package/templates_en/.agents/skills/craft-authoring/references/PROMPT_QUALITY_RUBRIC.md +92 -0
- package/templates_en/.agents/skills/craft-authoring/references/SCORECARD_TEMPLATE.md +52 -0
- package/templates_en/.agents/skills/design-reviewer/SKILL.md +264 -0
- package/templates_en/.agents/skills/e2e-testing-guide/SKILL.md +246 -0
- package/templates_en/.agents/skills/nexus-mapper/SKILL.md +306 -0
- package/templates_en/.agents/skills/nexus-mapper/references/language-customization.md +167 -0
- package/templates_en/.agents/skills/nexus-mapper/references/output-schema.md +311 -0
- package/templates_en/.agents/skills/nexus-mapper/references/probe-protocol.md +246 -0
- package/templates_en/.agents/skills/nexus-mapper/scripts/extract_ast.py +706 -0
- package/templates_en/.agents/skills/nexus-mapper/scripts/git_detective.py +194 -0
- package/templates_en/.agents/skills/nexus-mapper/scripts/languages.json +127 -0
- package/templates_en/.agents/skills/nexus-mapper/scripts/query_graph.py +556 -0
- package/templates_en/.agents/skills/nexus-mapper/scripts/requirements.txt +6 -0
- package/templates_en/.agents/skills/nexus-query/SKILL.md +114 -0
- package/templates_en/.agents/skills/nexus-query/scripts/extract_ast.py +706 -0
- package/templates_en/.agents/skills/nexus-query/scripts/git_detective.py +194 -0
- package/templates_en/.agents/skills/nexus-query/scripts/languages.json +127 -0
- package/templates_en/.agents/skills/nexus-query/scripts/query_graph.py +556 -0
- package/templates_en/.agents/skills/nexus-query/scripts/requirements.txt +6 -0
- package/templates_en/.agents/skills/output-contract/SKILL.md +37 -0
- package/templates_en/.agents/skills/runtime-inspector/SKILL.md +150 -0
- package/templates_en/.agents/skills/sequential-thinking/SKILL.md +214 -0
- package/templates_en/.agents/skills/spec-writer/SKILL.md +153 -0
- package/templates_en/.agents/skills/spec-writer/references/prd_template.md +177 -0
- package/templates_en/.agents/skills/system-architect/SKILL.md +538 -0
- package/templates_en/.agents/skills/system-architect/references/rfc_template.md +59 -0
- package/templates_en/.agents/skills/system-designer/SKILL.md +188 -0
- package/templates_en/.agents/skills/system-designer/references/system-design-detail-template.md +187 -0
- package/templates_en/.agents/skills/system-designer/references/system-design-template.md +605 -0
- package/templates_en/.agents/skills/task-planner/SKILL.md +251 -0
- package/templates_en/.agents/skills/task-planner/references/TASK_TEMPLATE_05A.md +109 -0
- package/templates_en/.agents/skills/task-planner/references/TASK_TEMPLATE_05B.md +176 -0
- package/templates_en/.agents/skills/task-reviewer/SKILL.md +422 -0
- package/templates_en/.agents/skills/tech-evaluator/SKILL.md +252 -0
- package/templates_en/.agents/skills/tech-evaluator/references/ADR_TEMPLATE.md +78 -0
- package/templates_en/.agents/workflows/blueprint.md +200 -0
- package/templates_en/.agents/workflows/challenge.md +326 -0
- package/templates_en/.agents/workflows/change.md +182 -0
- package/templates_en/.agents/workflows/craft.md +159 -0
- package/templates_en/.agents/workflows/design-system.md +202 -0
- package/templates_en/.agents/workflows/explore.md +187 -0
- package/templates_en/.agents/workflows/forge.md +651 -0
- package/templates_en/.agents/workflows/genesis.md +438 -0
- package/templates_en/.agents/workflows/probe.md +215 -0
- package/templates_en/.agents/workflows/quickstart.md +305 -0
- package/templates_en/.agents/workflows/upgrade.md +145 -0
- package/templates_en/AGENTS.md +149 -0
- package/templates/.agents/skills/report-template/SKILL.md +0 -92
- package/templates/.agents/skills/report-template/references/REPORT_TEMPLATE.md +0 -100
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: runtime-inspector
|
|
3
|
+
description: Load when `/probe` needs to identify runtime entrypoints, process boundaries, spawn chains, IPC channels, protocol strength, and lifecycle risks. Observes and reports only; does not modify code.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Runtime Inspector (ALPHA)
|
|
7
|
+
|
|
8
|
+
<phase_context>
|
|
9
|
+
You are **RUNTIME INSPECTOR**.
|
|
10
|
+
|
|
11
|
+
**Mission**: identify how the project starts, spawns processes, communicates, and fails; provide evidence for `/probe` Runtime Topology and Risk Matrix.
|
|
12
|
+
**Capabilities**: entrypoint discovery, spawn/fork chain detection, IPC surface inventory, protocol-strength classification, lifecycle and platform-security risk labeling.
|
|
13
|
+
**Limits**: do not start long-running services, do not modify code, and do not present static inference as runtime proof; use `Cannot confirm` when evidence is insufficient.
|
|
14
|
+
**Output Goal**: Process Roots, Spawning Chains, IPC Surfaces, Contract Status, Lifecycle Risks, and Security Flags.
|
|
15
|
+
</phase_context>
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## CRITICAL Output Contract
|
|
20
|
+
|
|
21
|
+
> [!IMPORTANT]
|
|
22
|
+
> Persisted-report rules, evidence rules, single-writer rules, and de-duplication rules follow `.agents/skills/output-contract/SKILL.md`. This skill returns an evidence slice for `/probe`.
|
|
23
|
+
>
|
|
24
|
+
> - Strong conclusions require a path, keyword, or command-output anchor.
|
|
25
|
+
> - Runtime behavior that was not actually exercised must be phrased as static evidence or `Cannot confirm`.
|
|
26
|
+
> - IPC contract classification must state the evidence: channel, message schema, version handshake, or missing pieces.
|
|
27
|
+
> - Windows Named Pipe permissions and parent/child process lifecycle are priority checks.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## sequential-thinking Rules
|
|
32
|
+
|
|
33
|
+
- No CoT model: call the `sequential-thinking` CLI.
|
|
34
|
+
- CoT model + simple single-process project: natural CoT is acceptable, but still answer entrypoint, communication, and failure questions.
|
|
35
|
+
- CoT model + multiprocess, IPC, spawn/fork, or protocol inference: call the `sequential-thinking` CLI.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Step 1: Identify Entrypoints
|
|
40
|
+
|
|
41
|
+
### What
|
|
42
|
+
Search for entrypoints that may represent independent processes:
|
|
43
|
+
|
|
44
|
+
| Language / Platform | Search Signals |
|
|
45
|
+
| --- | --- |
|
|
46
|
+
| Rust | `fn main()`, `#[tokio::main]` |
|
|
47
|
+
| Python | `if __name__ == "__main__":` |
|
|
48
|
+
| Node | `require.main === module`, `package.json` `bin` |
|
|
49
|
+
| Go | `func main()` |
|
|
50
|
+
|
|
51
|
+
### Why
|
|
52
|
+
Entrypoints define process boundaries; multiple entrypoints usually imply deployment, IPC, or lifecycle risks.
|
|
53
|
+
|
|
54
|
+
### Acceptance
|
|
55
|
+
- Output `Process Roots`: path, entrypoint type, inferred role.
|
|
56
|
+
- For multiple entrypoints, label independent process / parent-managed / `Cannot confirm`.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Step 2: Trace Spawn Chains
|
|
61
|
+
|
|
62
|
+
### What
|
|
63
|
+
Search for parent processes launching children:
|
|
64
|
+
|
|
65
|
+
| Platform | Search Signals |
|
|
66
|
+
| --- | --- |
|
|
67
|
+
| Rust | `Command::new`, `std::process::Stdio`, `tauri-plugin-shell` |
|
|
68
|
+
| Python | `subprocess.Popen`, `multiprocessing.Process` |
|
|
69
|
+
| Node | `child_process.spawn`, `child_process.fork` |
|
|
70
|
+
|
|
71
|
+
### Why
|
|
72
|
+
Spawn chains create lifecycle risk: parent exit, child crash, restart policy, and cleanup policy need explicit contracts.
|
|
73
|
+
|
|
74
|
+
### Acceptance
|
|
75
|
+
- Output `Spawning Chains`: parent path, child command/module, stdio/environment passing.
|
|
76
|
+
- Label zombie child, silent failure, restart gap, and cleanup gap where visible.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Step 3: Identify IPC Surfaces
|
|
81
|
+
|
|
82
|
+
### What
|
|
83
|
+
Search for communication channels and protocol definitions:
|
|
84
|
+
|
|
85
|
+
| Category | Search Signals |
|
|
86
|
+
| --- | --- |
|
|
87
|
+
| Channel | `Pipe`, `NamedPipe`, `unix_stream`, `zmq`, `TcpListener`, `UdpSocket`, `websocket`, `http::server` |
|
|
88
|
+
| Protocol | `Handshake`, `Version`, `MagicBytes`, `schema`, `protobuf`, `serde_json`, `JSON.parse`, `enum Message` |
|
|
89
|
+
|
|
90
|
+
### Why
|
|
91
|
+
A channel without schema, version, or handshake creates protocol drift, which is a core hidden risk in multiprocess systems.
|
|
92
|
+
|
|
93
|
+
### Acceptance
|
|
94
|
+
- Output `IPC Surfaces`: channel type, location, protocol evidence.
|
|
95
|
+
- Every IPC surface has `Contract Status`.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Contract Status
|
|
100
|
+
|
|
101
|
+
| Status | Rule |
|
|
102
|
+
| --- | --- |
|
|
103
|
+
| Strong | channel + explicit message schema / enum / protobuf, or a version handshake |
|
|
104
|
+
| Weak | channel + raw JSON/string, but no centralized schema or version |
|
|
105
|
+
| None | channel exists, but no protocol definition is found |
|
|
106
|
+
| Cannot confirm | static evidence is insufficient |
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Risk Patterns
|
|
111
|
+
|
|
112
|
+
| Risk | Detection Signal | Recommendation |
|
|
113
|
+
| --- | --- | --- |
|
|
114
|
+
| Protocol Mismatch | channel exists without schema/version/handshake | add protocol schema or version handshake task |
|
|
115
|
+
| Zombie Child | spawn exists without exit cleanup or heartbeat | add kill-on-exit, heartbeat, or cleanup contract |
|
|
116
|
+
| Silent Failure | child failure has no error propagation or restart policy | add error propagation, retry, or supervisor strategy |
|
|
117
|
+
| Named Pipe Permission Risk | Windows Named Pipe lacks explicit ACL | add permission-boundary design and verification |
|
|
118
|
+
| Race Condition | multiprocess messages lack ordering, locks, or idempotency | add sequence numbers, locks, or idempotency contract |
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Required Output
|
|
123
|
+
|
|
124
|
+
```markdown
|
|
125
|
+
## Runtime Inspector Findings
|
|
126
|
+
|
|
127
|
+
### Process Roots
|
|
128
|
+
| Path | Entrypoint | Role | Confidence |
|
|
129
|
+
|
|
130
|
+
### Spawning Chains
|
|
131
|
+
| Parent | Child | Channel / stdio | Lifecycle Risk |
|
|
132
|
+
|
|
133
|
+
### IPC Surfaces
|
|
134
|
+
| Path | Channel | Protocol Evidence | Contract Status |
|
|
135
|
+
|
|
136
|
+
### Lifecycle Risks
|
|
137
|
+
| Risk | Evidence | Impact | Suggested follow-up |
|
|
138
|
+
|
|
139
|
+
### Security Flags
|
|
140
|
+
| Flag | Evidence | Severity | Suggested follow-up |
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
<completion_criteria>
|
|
146
|
+
- Process Roots, Spawning Chains, IPC Surfaces, Contract Status, and Lifecycle Risks are present or explicitly `N/A + reason`.
|
|
147
|
+
- Strong/Weak/None/Cannot confirm classifications include evidence.
|
|
148
|
+
- Static inference is not presented as runtime proof.
|
|
149
|
+
- Output can be merged directly into `/probe` Runtime Topology and Risk Matrix.
|
|
150
|
+
</completion_criteria>
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sequential-thinking
|
|
3
|
+
description: Use when complex problems require systematic step-by-step reasoning. Suitable for multi-stage analysis, design planning, problem decomposition, or tasks with unclear initial scope that require controlled convergence.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Sequential Thinking
|
|
7
|
+
|
|
8
|
+
The core of this skill is not "write more thoughts." It is to let AI **continuously advance, allow correction, and finally converge on conclusions** in complex problems. The CLI is only the execution carrier; the skill itself defines when to enter this thinking mode and how to avoid degrading sequential thinking into loose output.
|
|
9
|
+
|
|
10
|
+
## Mission
|
|
11
|
+
|
|
12
|
+
Use this skill to turn complex problems into a **bounded, correctable, reviewable reasoning process**:
|
|
13
|
+
|
|
14
|
+
- Clarify the problem first, instead of rushing to answers
|
|
15
|
+
- Allow correction and judgment updates during progress
|
|
16
|
+
- Compare alternatives when complexity increases, instead of forcing one path
|
|
17
|
+
- Converge to conclusions and recommendations within limited steps
|
|
18
|
+
- Preserve a replayable reasoning trace at the end
|
|
19
|
+
|
|
20
|
+
This skill does not solve "can't think." It solves "thinking too scattered, concluding too early, too hard to review."
|
|
21
|
+
|
|
22
|
+
## Core Capabilities
|
|
23
|
+
|
|
24
|
+
- **Iterative advancement**: break complex problems into consecutive steps
|
|
25
|
+
- **Dynamic correction**: revisit and revise earlier judgments when new evidence appears
|
|
26
|
+
- **Branch comparison**: compare alternatives before converging
|
|
27
|
+
- **Context retention**: keep clear boundaries and goals in multi-step reasoning
|
|
28
|
+
- **Conclusion closure**: must end with a judgment, not endless divergence
|
|
29
|
+
|
|
30
|
+
## When to Use
|
|
31
|
+
|
|
32
|
+
### Core Decision Rule
|
|
33
|
+
|
|
34
|
+
> **Model capability sets baseline; task complexity decides escalation.**
|
|
35
|
+
|
|
36
|
+
| Model capability | Simple task | Complex task |
|
|
37
|
+
|---------|:-------:|:-------:|
|
|
38
|
+
| **Has CoT** | Natural CoT is enough | Call ST CLI |
|
|
39
|
+
| **No CoT** | **Must call ST CLI** | **Must call ST CLI** |
|
|
40
|
+
|
|
41
|
+
### Mnemonic
|
|
42
|
+
|
|
43
|
+
> **"No CoT -> must use ST**
|
|
44
|
+
> **Has CoT -> use ST only for complex tasks"**
|
|
45
|
+
|
|
46
|
+
### Scenarios where CLI is mandatory
|
|
47
|
+
|
|
48
|
+
| Scenario | Decision standard | Why CLI is needed |
|
|
49
|
+
|------|---------|---------------|
|
|
50
|
+
| **No CoT model** | Current model cannot output chain-of-thought | External tool required to structure reasoning |
|
|
51
|
+
| **Premise correction** | Earlier judgment is wrong and must be revised | CLI session keeps history for revision |
|
|
52
|
+
| **Multi-option comparison** | Need trade-offs between 2+ candidates | `branch` mode is designed for this |
|
|
53
|
+
| **Replayable trace** | Need auditable, reproducible reasoning | CLI can generate replay docs |
|
|
54
|
+
| **Complex convergence** | Problem needs >5 steps to converge | Forced step limits prevent endless divergence |
|
|
55
|
+
|
|
56
|
+
### Scenarios where natural CoT is enough (with CoT)
|
|
57
|
+
|
|
58
|
+
| Scenario | Decision standard | Why CLI is not needed |
|
|
59
|
+
|------|---------|-----------------|
|
|
60
|
+
| **Linear reasoning** | No premise correction, linear progression | Model output is sufficient |
|
|
61
|
+
| **Simple analysis** | Clear boundaries, <5 steps | No extra tooling required |
|
|
62
|
+
| **Quick decision** | Need conclusion only, no replay trace | CoT is sufficient |
|
|
63
|
+
| **Exploratory thinking** | Still diverging, uncertain about convergence | Explore with CoT first, then decide |
|
|
64
|
+
|
|
65
|
+
### Decision tree
|
|
66
|
+
|
|
67
|
+
```mermaid
|
|
68
|
+
flowchart TD
|
|
69
|
+
A[Need multi-step reasoning?] -->|No| Z[Answer directly]
|
|
70
|
+
A -->|Yes| B{Model has CoT?}
|
|
71
|
+
B -->|No| CLI[Must call ST CLI]
|
|
72
|
+
B -->|Yes| C{Task complex?}
|
|
73
|
+
C -->|Simple: <5 steps, no revision| CoT[Natural CoT]
|
|
74
|
+
C -->|Complex: revision/comparison/replay| CLI
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Not suitable for
|
|
78
|
+
|
|
79
|
+
- Simple fact lookup
|
|
80
|
+
- Tasks solvable in one step
|
|
81
|
+
- Problems with already obvious path and no multi-step derivation needed
|
|
82
|
+
- Pure brainstorming without required convergence
|
|
83
|
+
|
|
84
|
+
## Working Philosophy
|
|
85
|
+
|
|
86
|
+
- **Find the core problem before answers**: do not mistake symptom description for root cause diagnosis
|
|
87
|
+
- **Allow corrections instead of defending bad premises**: if earlier steps are wrong, go back and fix
|
|
88
|
+
- **Reduce complexity before adding solutions**: identify the principal contradiction first
|
|
89
|
+
- **Advance one step at a time**: current step states only current judgment
|
|
90
|
+
- **Must land on conclusions**: "I can keep thinking" is not a default exit
|
|
91
|
+
|
|
92
|
+
## Installation & Runtime Model
|
|
93
|
+
|
|
94
|
+
This skill provides thinking method and invocation constraints for agents; CLI is distributed via npm.
|
|
95
|
+
|
|
96
|
+
Before use, ensure CLI is installed locally:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npm install -g sequential-thinking-cli
|
|
100
|
+
|
|
101
|
+
# or
|
|
102
|
+
pnpm add -g sequential-thinking-cli
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
After installation, use `sthink` as command entry.
|
|
106
|
+
|
|
107
|
+
## CLI Contract
|
|
108
|
+
|
|
109
|
+
This skill no longer requires AI to hand-write thought JSON. Execution uses main CLI actions:
|
|
110
|
+
|
|
111
|
+
- `start`
|
|
112
|
+
- `step`
|
|
113
|
+
- `replay`
|
|
114
|
+
|
|
115
|
+
### `start`
|
|
116
|
+
|
|
117
|
+
Accepts only four inputs:
|
|
118
|
+
|
|
119
|
+
- `name`
|
|
120
|
+
- `goal`
|
|
121
|
+
- `mode`
|
|
122
|
+
- `totalSteps`
|
|
123
|
+
|
|
124
|
+
Constraints:
|
|
125
|
+
|
|
126
|
+
- `mode` only allows `explore`, `branch`, `audit`
|
|
127
|
+
- `totalSteps` only allows `5` or `8`
|
|
128
|
+
|
|
129
|
+
If unsure which mode to use, default to `explore`. Use `branch` only when clearly comparing candidate paths; use `audit` only when clearly reviewing existing judgments.
|
|
130
|
+
|
|
131
|
+
### `step`
|
|
132
|
+
|
|
133
|
+
Accepts only:
|
|
134
|
+
|
|
135
|
+
- `content`
|
|
136
|
+
|
|
137
|
+
All other context should be automatically restored and injected by runtime.
|
|
138
|
+
|
|
139
|
+
### `replay`
|
|
140
|
+
|
|
141
|
+
Used to read completed sessions and generate replay docs; optionally export to current directory.
|
|
142
|
+
|
|
143
|
+
## Recommended Workflow
|
|
144
|
+
|
|
145
|
+
```text
|
|
146
|
+
1. Decide whether the problem truly needs sequential-thinking; do not apply by default.
|
|
147
|
+
2. If needed, install or confirm local npm CLI.
|
|
148
|
+
3. Use `sthink start` with `name`, `goal`, `mode`, `totalSteps`.
|
|
149
|
+
4. Use `sthink step` to advance step by step; each step contains only current progress.
|
|
150
|
+
5. When new evidence appears, correct earlier judgments.
|
|
151
|
+
6. At convergence, output conclusion, risks, and next-step recommendations.
|
|
152
|
+
7. Optionally run `sthink replay` to generate/export replay docs.
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Examples
|
|
156
|
+
|
|
157
|
+
The following examples are not for hand-writing JSON; they show where this skill provides real value: **advance, correct, converge**.
|
|
158
|
+
|
|
159
|
+
### Example 1: Basic reasoning
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
sthink start --name "query-diagnosis" --goal "locate root cause of query performance degradation" --mode explore --totalSteps 5
|
|
163
|
+
sthink step --sessionPath "<session-path>" --content "Do not rush to pick optimization means. First split layers: single SQL degradation, interface-level N+1, or upper-layer amplification. If root cause is unclear, cache/index/rewrite may all become patches."
|
|
164
|
+
sthink step --sessionPath "<session-path>" --content "Logs show user-detail endpoint triggers many repeated reads in one request, with clear N+1 signals. But cannot conclude yet; repeated queries may be symptoms. Need to verify whether slowness is from query count or one inherently slow query. Increase total steps."
|
|
165
|
+
sthink step --sessionPath "<session-path>" --content "Converged: primary cause is N+1 during list-page batch loading; secondary cause is missing index on related fields amplifying single-query cost. Sequence should remove N+1 first, then add index and validate tail latency."
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Example 2: Premise correction
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
sthink step --sessionPath "<session-path>" --content "After reviewing profiling results, prior judgment needs correction: the real bottleneck is missing index on join columns, which amplifies full-scan costs per join. N+1 still exists but is not first-order bottleneck; priority should move down."
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Example 3: Complex change decomposition
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
sthink start --name "change-impact-analysis" --goal "decompose impact and priorities of complex changes" --mode explore --totalSteps 5
|
|
178
|
+
sthink step --sessionPath "<session-path>" --content "User proposed multiple rule changes at once; do not treat them as one type. Split by type: mechanism principles, numeric balancing, interface semantic changes, and doc-implementation drift."
|
|
179
|
+
sthink step --sessionPath "<session-path>" --content "Build an impact matrix. Mechanism changes flow into ADR/System Design; numeric balancing affects rule tables/config/test baselines; interface semantic changes are most dangerous because they silently break caller assumptions."
|
|
180
|
+
sthink step --sessionPath "<session-path>" --content "Converged: first handle items changing system boundaries or call semantics, then numeric/experience items. Sequence should fix docs/contracts before balancing, otherwise implementation and review build on drifting premises."
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Example 4: Branch comparison
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
sthink start --name "performance-tradeoff" --goal "compare priority of cache stopgap vs query optimization" --mode branch --totalSteps 5
|
|
187
|
+
sthink step --sessionPath "<session-path>" --content "Option A: introduce cache first to reduce peaks. Fast effect, low interface intrusion, good for stopgap; downside is complexity in consistency/invalidation and may preserve accidental complexity. Option B: optimize indexes and rewrite queries directly. Root-cause oriented and cleaner long-term, but requires careful validation of write amplification, lock contention, and regression risk."
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Storage & Export Boundary
|
|
191
|
+
|
|
192
|
+
- runtime automatically saves session state and step records
|
|
193
|
+
- replay docs can be generated after completion
|
|
194
|
+
- `replay` supports export to current directory for review/reuse
|
|
195
|
+
|
|
196
|
+
## Heuristic Reminders
|
|
197
|
+
|
|
198
|
+
These are heuristic prompts, not hard constraints. The key is reducing wasted loops and approaching conclusions.
|
|
199
|
+
|
|
200
|
+
- **Problem-definition prompt**: Are you describing symptoms or locating root cause?
|
|
201
|
+
- **Evidence prompt**: Is current judgment based on facts/observations or guesses?
|
|
202
|
+
- **Boundary prompt**: Is impact local module, single system, or cross-system?
|
|
203
|
+
- **Complexity prompt**: Are you reducing essential complexity or adding accidental complexity?
|
|
204
|
+
- **Convergence prompt**: Is there enough to conclude, or still ineffective divergence?
|
|
205
|
+
|
|
206
|
+
## Tips
|
|
207
|
+
|
|
208
|
+
- Do not hand-write thought JSON; let CLI runtime handle pacing, persistence, replay
|
|
209
|
+
- Do not treat sequential-thinking as default; use only when multi-step convergence is truly needed
|
|
210
|
+
- If unsure mode, start with `explore`
|
|
211
|
+
- `step` `content` should only express current progress, not repeated full context
|
|
212
|
+
- If a premise is wrong, state correction explicitly
|
|
213
|
+
- At convergence, clearly output conclusions, risks, next actions
|
|
214
|
+
- `replay` is available only for completed sessions
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spec-writer
|
|
3
|
+
description: "genesis Step 2: turn fuzzy or high-level needs into strict product requirement documents (PRDs); includes craft scaffolding, PRD spec contract, optional sub-agent shard orchestration, and Step completion signals. Use when requirements are vague, scope is too large, or expression stays conceptual."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Requirements Detective Handbook
|
|
7
|
+
|
|
8
|
+
> "The hardest part of building software isn't how to implement it—it's precisely defining what to implement."
|
|
9
|
+
|
|
10
|
+
Your job is to **eliminate ambiguity**.
|
|
11
|
+
|
|
12
|
+
## genesis Step 2 (scope and handoff)
|
|
13
|
+
|
|
14
|
+
Compared with `templates/.agents/skills/spec-writer`, this template adds **craft scaffolding**, **spec contract** (on-disk semantics), **sub-agent orchestration**, and **completion**. The normative force of **Execution checklist / Methodology / 10-dimension ambiguity scan / User Story quality gate** sections is **unchanged**—rules such as Socratic probing, **one question at a time**, the hard cap on `[NEEDS CLARIFICATION]`, Non-Goals, and the User Story gate **apply verbatim**.
|
|
15
|
+
|
|
16
|
+
### Craft scaffolding (artifact skeleton)
|
|
17
|
+
|
|
18
|
+
Before **Execution checklist** step 4 (writing `01_PRD.md`), the skeleton **must first** be in place; when filling content, **do not remove normative sections** from the template. Where there is no information, write **`[NOT APPLICABLE | reason]`** or **`[ASSUMPTION]`**—never leave blanks that pretend completeness.
|
|
19
|
+
|
|
20
|
+
| Artifact | Path | Requirement |
|
|
21
|
+
|----------|------|---------------|
|
|
22
|
+
| Version directory | `.anws/v{N}/` | `v{N}` must match host genesis / session convention; create on first round or explicitly reuse existing `v{N}`; silent fork forbidden. |
|
|
23
|
+
| PRD | `.anws/v{N}/01_PRD.md` | **Single source of truth** for Step 2 output; content driven by `references/prd_template.md`; **forbidden** to replace on-disk artifact with long chat-only prose only. |
|
|
24
|
+
| Template | `references/prd_template.md` | Read in full **before** drafting PRD; heading levels and mandatory sections follow the template; extra appendices allowed but cannot replace mandatory template sections. |
|
|
25
|
+
|
|
26
|
+
**Readiness check (internal; may summarize for user):** `v{N}` chosen; this SKILL + `prd_template.md` read; enumerate at least 3 User Story drafts and ≥3 Non-Goals before expanding written PRD sections.
|
|
27
|
+
|
|
28
|
+
### Spec contract (PRD on-disk semantics)
|
|
29
|
+
|
|
30
|
+
> [!IMPORTANT]
|
|
31
|
+
> When folded into the genesis pipeline, PRD sections are treated as **assertable draft contracts** for downstream work (architecture, task breakdown, challenge) and must satisfy:
|
|
32
|
+
>
|
|
33
|
+
> - **Verifiable:** Any statement of "must / must not / SLA / user counts / compatibility" needs Given-When-Then, metrics, or enumerated options; otherwise it cannot be marked as implemented—only `[ASSUMPTION]` or move to Non-Goals.
|
|
34
|
+
> - **Traceable:** Every User Story carries `[REQ-XXX]`; terms and systems must be **internally consistent** with "Affected systems" below (when aligning to `02_ARCHITECTURE_OVERVIEW.md` downstream, no arbitrary renames).
|
|
35
|
+
> - **Ambiguity-bounded:** `[NEEDS CLARIFICATION]` **≤ 3** (hard limit); if exceeded, use defaults + `[ASSUMPTION: …]`; **forbidden** to re-ask generic defaults stated in this document's 10-dimension scan to pad counts.
|
|
36
|
+
> - **Value-traceable:** Every requirement aligns to user value in one sentence; Non-Goals and Goals are **mutually exclusive** with no empty "maybe won't do".
|
|
37
|
+
> - **Consistent:** The same fact is **not stated twice contradictorily** in summary vs detail; fixes use **atomic paragraph replacement**, not side-by-side conflicting wording.
|
|
38
|
+
|
|
39
|
+
Challenge / downstream alignment: If excerpts from the PRD appear in reports or attachments, excerpts must carry **subsection anchors** or **stable headings from `01_PRD.md`**; do not cite only "see PRD".
|
|
40
|
+
|
|
41
|
+
### Sub-agent orchestration (optional)
|
|
42
|
+
|
|
43
|
+
When the host supports parallel sub-sessions:
|
|
44
|
+
|
|
45
|
+
| Role | Responsibility |
|
|
46
|
+
|------|----------------|
|
|
47
|
+
| **Parent agent** | Choose `v{N}`, load user intent and context, merge structured blocks returned by sub-agents, **dedupe and pick best among same-topic answers**, maintain **single writer** for `.anws/v{N}/01_PRD.md`, run mandatory "10-dimension ambiguity scan" and User Story quality gate, then deliver for user confirmation. |
|
|
48
|
+
| **Sub-agent** | Consumes bounded slices only—e.g. "generate clarification question batches only (with suggested answers)", "extract / rewrite User Stories only (still drafts)", "annotate dimension k of the 10-dimension table with Clear/Partial/Missing + patch suggestions", "rewrite feeling words into candidate metric lists only"; return **Markdown structured blocks + anchor suggestions**; do not assume access to parent-only context. |
|
|
49
|
+
|
|
50
|
+
**Single writer:** Only **one** writer for `01_PRD.md` per genesis Step 2 round; sub-agents must not write that path without parent authorization.
|
|
51
|
+
|
|
52
|
+
#### Handoff checklist (sub → parent)
|
|
53
|
+
|
|
54
|
+
- [ ] State deliverable type (question list / Story draft / scan vector / feeling-word metric table) and **N/A dimensions** (one-line reason each).
|
|
55
|
+
- [ ] Every item maps to a **subsection title or `[REQ-XXX]` placeholder** the PRD will use; if no anchor, mark "pending parent mount".
|
|
56
|
+
- [ ] Do not introduce requirements conflicting with parent-declared Non-Goals; if conflict is possible, list "requires parent ruling".
|
|
57
|
+
- [ ] Sub-agent stops at structured handoff; subsequent edits merged by parent.
|
|
58
|
+
|
|
59
|
+
### Completion (genesis Step 2 done signal)
|
|
60
|
+
|
|
61
|
+
Step 2 **must not be claimed complete** unless all of:
|
|
62
|
+
|
|
63
|
+
| Gate | Condition |
|
|
64
|
+
|------|-----------|
|
|
65
|
+
| On-disk | `.anws/v{N}/01_PRD.md` exists and opens standalone; structure aligns with **mandatory sections** of `prd_template.md`. |
|
|
66
|
+
| Content | Contains User Stories (pass quality gate), acceptance criteria, **≥3** Non-Goals; every requirement is testable, measurable, or explicitly assumed. |
|
|
67
|
+
| Ambiguity | "10-dimension ambiguity scan" executed; every `Partial` / `Missing` fixed, `[ASSUMPTION]`-ized, or closed under hard-limit rules. |
|
|
68
|
+
| Tags | `[NEEDS CLARIFICATION]` **≤ 3**; no Story has untracked feeling words unless rewritten or assumed away. |
|
|
69
|
+
| Human | **User confirmed PRD** (or explicitly waived in writing logged as `[ASSUMPTION: stakeholder sign-off deferred]`); do not fake confirmation. |
|
|
70
|
+
| Handoff | Parent delivered **short summary table** to user (goals / key REQ count / open clarifications / Non-Goals count / recommended reading order for next Step). |
|
|
71
|
+
|
|
72
|
+
Failing any **hard** row above → Step 2 is **blocked / in_progress**; do not silently advance the pipeline into architecture drafting.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Execution checklist (single source of order)
|
|
77
|
+
|
|
78
|
+
Aligned with **craft scaffolding** and the **completion** table above; release is gated by **completion hard rows**—this section only sequences work (merges former Quick start / Mandatory steps / Completion checklist to avoid duplicate reading).
|
|
79
|
+
|
|
80
|
+
1. **Read the request**: identify feeling words and hidden boundaries (mandatory).
|
|
81
|
+
2. **Think deeply**: 3–7 rounds of structured reasoning (by complexity); produce User Story drafts, ambiguity, clarification questions (mandatory).
|
|
82
|
+
3. **Probe for answers**: do not advance the main line until answers arrive (mandatory).
|
|
83
|
+
4. **Before disk**: ≥3 User Stories, ≥3 Non-Goals, clarify feeling words; read `references/prd_template.md`, create `.anws/v{N}/01_PRD.md`—**do not** substitute chat for disk (mandatory).
|
|
84
|
+
5. **After disk**: run the **10-dimension ambiguity scan** and close `Partial` / `Missing`; User Story quality gate; `[NEEDS CLARIFICATION]` ≤ 3 (mandatory).
|
|
85
|
+
6. **Close**: satisfy **completion** hard rows + user sign-off on PRD (or logged waiver).
|
|
86
|
+
|
|
87
|
+
## Methods and tools
|
|
88
|
+
|
|
89
|
+
### 1. Socratic probing
|
|
90
|
+
* **User:** "I want it to be fast."
|
|
91
|
+
* **You:** "Does that mean p99 under 100ms? Or optimistic UI updates only?"
|
|
92
|
+
* *Goal:* Turn adjectives into numbers and verifiable criteria.
|
|
93
|
+
|
|
94
|
+
### 2. Context compression
|
|
95
|
+
* **Input:** 500-line chat log.
|
|
96
|
+
* **Action:** Extract *User Stories*—"As a User, I want X, so that Y."
|
|
97
|
+
* **Drop:** Premature implementation details (e.g. "use Redis").
|
|
98
|
+
|
|
99
|
+
### 3. Non-Goals (draw the circle)
|
|
100
|
+
* Explicitly define what we **do not do**.
|
|
101
|
+
* *Why:* Prevent scope creep and endless "what about X?" follow-ups.
|
|
102
|
+
|
|
103
|
+
## Detective rules
|
|
104
|
+
|
|
105
|
+
1. **Contract first:** If it cannot be verified, do not put it in the PRD.
|
|
106
|
+
2. **Don't steal design work:** Describe *what* to do, not prematurely *how*. Implementation belongs in architecture.
|
|
107
|
+
3. **User value first:** Every requirement must trace to clear user value.
|
|
108
|
+
|
|
109
|
+
## Toolbox
|
|
110
|
+
* `references/prd_template.md`: Product requirements template.
|
|
111
|
+
|
|
112
|
+
## 10-dimension ambiguity scan
|
|
113
|
+
|
|
114
|
+
After drafting the PRD, you **must** scan the full text across these 10 dimensions. This replaces ad-hoc "anything else?" with a **repeatable, exhaustive** pass.
|
|
115
|
+
|
|
116
|
+
For each dimension, mark status: `Clear` / `Partial` / `Missing`
|
|
117
|
+
|
|
118
|
+
| # | Dimension | What to check | Status |
|
|
119
|
+
|---|-----------|---------------|:------:|
|
|
120
|
+
| 1 | **Functional scope and behavior** | Core goals / success criteria / explicit exclusions / user role distinction | |
|
|
121
|
+
| 2 | **Domain and data model** | Entities, attributes, relationships / uniqueness rules / lifecycle and state transitions / data volume assumptions | |
|
|
122
|
+
| 3 | **Interaction and UX flows** | Key user paths / error, empty, loading states / a11y and i18n | |
|
|
123
|
+
| 4 | **Non-functional quality** | Performance / scalability / reliability / observability / security and privacy / compliance | |
|
|
124
|
+
| 5 | **Integrations and externals** | External failure modes / import-export formats / protocol version assumptions | |
|
|
125
|
+
| 6 | **Edge cases and failures** | Negative paths / rate limits / concurrent conflict handling | |
|
|
126
|
+
| 7 | **Constraints and tradeoffs** | Technical constraints / explicit tradeoffs / rejected architecture options | |
|
|
127
|
+
| 8 | **Terminology consistency** | Glossary / synonym unification across the doc | |
|
|
128
|
+
| 9 | **Done signals** | Acceptance testable? / DoD quantifiable? | |
|
|
129
|
+
| 10 | **Placeholders and vague words** | TODOs / unquantified adjectives (fast, scalable, secure, intuitive, robust) | |
|
|
130
|
+
|
|
131
|
+
**Rules:**
|
|
132
|
+
- For `Partial` or `Missing`, sort by **impact × uncertainty**, ask user about top **5**
|
|
133
|
+
- **One question at a time**; offer a suggested answer; user may accept or customize
|
|
134
|
+
- After answers, **atomically write** the matching PRD section; no mutually contradictory text
|
|
135
|
+
- `[NEEDS CLARIFICATION]` **hard cap ≤ 3**; if still over, use reasonable defaults + `[ASSUMPTION: ...]`
|
|
136
|
+
- **Do not ask users to clarify these reasonable defaults:** industry-standard data retention, typical web/mobile performance expectations, friendly errors with fallbacks, standard Session or OAuth2 authentication
|
|
137
|
+
|
|
138
|
+
## User Story quality gate
|
|
139
|
+
|
|
140
|
+
Every User Story in the PRD **must** pass before the PRD is considered done:
|
|
141
|
+
|
|
142
|
+
| Check | Requirement |
|
|
143
|
+
|-------|---------------|
|
|
144
|
+
| **Unique ID** | Must include `[REQ-XXX]` for traceability |
|
|
145
|
+
| **Priority** | P0 / P1 / P2, P0 first |
|
|
146
|
+
| **Independently testable** | How the story is **independently** demoed and verified |
|
|
147
|
+
| **Affected systems** | Concrete system IDs (must align with `02_ARCHITECTURE_OVERVIEW.md`) |
|
|
148
|
+
| **Acceptance criteria** | At least one Given-When-Then + at least one error path |
|
|
149
|
+
| **Edge cases** | At least one boundary condition |
|
|
150
|
+
| **No vague feeling words** | No unquantified adjectives (e.g. fast → <100ms p99; scalable → supports N users) |
|
|
151
|
+
| **User value** | One-sentence end-user value |
|
|
152
|
+
|
|
153
|
+
If any User Story fails, **fix before delivering the PRD**.
|