pi-maestro-flow 0.2.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 +124 -0
- package/agents/aggregator.md +27 -0
- package/agents/cli-explore-agent.md +188 -0
- package/agents/cross-role-reviewer.md +171 -0
- package/agents/delegate.md +19 -0
- package/agents/explorer.md +23 -0
- package/agents/impeccable-agent.md +99 -0
- package/agents/ralph-executor.md +81 -0
- package/agents/reference.md +24 -0
- package/agents/role-design-author.md +220 -0
- package/agents/team-supervisor.md +143 -0
- package/agents/team-worker.md +237 -0
- package/agents/ui-design-agent.md +270 -0
- package/agents/workflow-analyzer.md +116 -0
- package/agents/workflow-codebase-mapper.md +77 -0
- package/agents/workflow-collab-planner.md +147 -0
- package/agents/workflow-debugger.md +104 -0
- package/agents/workflow-executor.md +133 -0
- package/agents/workflow-external-researcher.md +86 -0
- package/agents/workflow-integration-checker.md +83 -0
- package/agents/workflow-nyquist-auditor.md +85 -0
- package/agents/workflow-phase-researcher.md +85 -0
- package/agents/workflow-plan-checker.md +100 -0
- package/agents/workflow-planner.md +200 -0
- package/agents/workflow-project-researcher.md +74 -0
- package/agents/workflow-research-synthesizer.md +70 -0
- package/agents/workflow-reviewer.md +82 -0
- package/agents/workflow-roadmapper.md +81 -0
- package/agents/workflow-verifier.md +120 -0
- package/package.json +58 -0
- package/skills/codify-to-knowhow/SKILL.md +167 -0
- package/skills/delegation-check/SKILL.md +297 -0
- package/skills/domain-add/SKILL.md +75 -0
- package/skills/insight-challenge/SKILL.md +226 -0
- package/skills/learn-decompose/SKILL.md +124 -0
- package/skills/learn-follow/SKILL.md +163 -0
- package/skills/learn-investigate/SKILL.md +160 -0
- package/skills/learn-second-opinion/SKILL.md +128 -0
- package/skills/maestro/SKILL.md +239 -0
- package/skills/maestro-amend/SKILL.md +169 -0
- package/skills/maestro-analyze/SKILL.md +173 -0
- package/skills/maestro-blueprint/SKILL.md +159 -0
- package/skills/maestro-brainstorm/SKILL.md +193 -0
- package/skills/maestro-collab/SKILL.md +181 -0
- package/skills/maestro-companion/SKILL.md +536 -0
- package/skills/maestro-composer/SKILL.md +192 -0
- package/skills/maestro-execute/SKILL.md +193 -0
- package/skills/maestro-fork/SKILL.md +104 -0
- package/skills/maestro-grill/SKILL.md +151 -0
- package/skills/maestro-guard/SKILL.md +124 -0
- package/skills/maestro-help/SKILL.md +328 -0
- package/skills/maestro-impeccable/SKILL.md +302 -0
- package/skills/maestro-init/SKILL.md +151 -0
- package/skills/maestro-merge/SKILL.md +90 -0
- package/skills/maestro-milestone-audit/SKILL.md +117 -0
- package/skills/maestro-milestone-complete/SKILL.md +133 -0
- package/skills/maestro-milestone-release/SKILL.md +131 -0
- package/skills/maestro-next/SKILL.md +269 -0
- package/skills/maestro-overlay/SKILL.md +203 -0
- package/skills/maestro-plan/SKILL.md +194 -0
- package/skills/maestro-player/SKILL.md +184 -0
- package/skills/maestro-quick/SKILL.md +117 -0
- package/skills/maestro-ralph/SKILL.md +905 -0
- package/skills/maestro-ralph-cli/SKILL.md +976 -0
- package/skills/maestro-ralph-cli-execute/SKILL.md +229 -0
- package/skills/maestro-ralph-execute/SKILL.md +409 -0
- package/skills/maestro-ralph-v2/SKILL.md +1198 -0
- package/skills/maestro-roadmap/SKILL.md +157 -0
- package/skills/maestro-swarm-workflow/SKILL.md +272 -0
- package/skills/maestro-tools-execute/SKILL.md +143 -0
- package/skills/maestro-tools-register/SKILL.md +192 -0
- package/skills/maestro-ui-codify/SKILL.md +127 -0
- package/skills/maestro-universal-workflow/SKILL.md +622 -0
- package/skills/maestro-update/SKILL.md +156 -0
- package/skills/manage-codebase-rebuild/SKILL.md +111 -0
- package/skills/manage-drift-realign/SKILL.md +159 -0
- package/skills/manage-harvest/SKILL.md +121 -0
- package/skills/manage-issue/SKILL.md +88 -0
- package/skills/manage-issue-discover/SKILL.md +104 -0
- package/skills/manage-kg-extractors/SKILL.md +147 -0
- package/skills/manage-knowhow/SKILL.md +102 -0
- package/skills/manage-knowhow-capture/SKILL.md +109 -0
- package/skills/manage-knowledge-audit/SKILL.md +147 -0
- package/skills/manage-status/SKILL.md +80 -0
- package/skills/manage-wiki/SKILL.md +104 -0
- package/skills/odyssey-debug/SKILL.md +344 -0
- package/skills/odyssey-improve/SKILL.md +423 -0
- package/skills/odyssey-planex/SKILL.md +542 -0
- package/skills/odyssey-review-test-fix/SKILL.md +392 -0
- package/skills/odyssey-ui/SKILL.md +388 -0
- package/skills/prompt-generator/SKILL.md +470 -0
- package/skills/quality-auto-test/SKILL.md +168 -0
- package/skills/quality-debug/SKILL.md +176 -0
- package/skills/quality-refactor/SKILL.md +108 -0
- package/skills/quality-retrospective/SKILL.md +134 -0
- package/skills/quality-review/SKILL.md +169 -0
- package/skills/quality-sync/SKILL.md +90 -0
- package/skills/quality-test/SKILL.md +183 -0
- package/skills/scholar-anti-ai-writing/SKILL.md +173 -0
- package/skills/scholar-anti-ai-writing/references/patterns-chinese.md +242 -0
- package/skills/scholar-anti-ai-writing/references/patterns-english.md +242 -0
- package/skills/scholar-citation-verify/SKILL.md +166 -0
- package/skills/scholar-citation-verify/references/api-usage.md +372 -0
- package/skills/scholar-citation-verify/references/common-errors.md +384 -0
- package/skills/scholar-citation-verify/references/verification-rules.md +399 -0
- package/skills/scholar-experiment/SKILL.md +321 -0
- package/skills/scholar-ideation/SKILL.md +288 -0
- package/skills/scholar-latex-organizer/SKILL.md +186 -0
- package/skills/scholar-publish/SKILL.md +220 -0
- package/skills/scholar-rebuttal-pro/README.md +313 -0
- package/skills/scholar-rebuttal-pro/SKILL.md +511 -0
- package/skills/scholar-review/SKILL.md +227 -0
- package/skills/scholar-thesis-docx/README.md +111 -0
- package/skills/scholar-thesis-docx/README_EN.md +108 -0
- package/skills/scholar-thesis-docx/SKILL.md +212 -0
- package/skills/scholar-thesis-docx/references/failure-patterns-and-quality-gates.md +178 -0
- package/skills/scholar-thesis-docx/references/figure-and-code-rules.md +33 -0
- package/skills/scholar-thesis-docx/references/paper-format-workflow.md +68 -0
- package/skills/scholar-thesis-docx/references/script-usage.md +157 -0
- package/skills/scholar-thesis-docx/scripts/audit_docx_ooxml.py +429 -0
- package/skills/scholar-thesis-docx/scripts/check_word_com.ps1 +50 -0
- package/skills/scholar-thesis-docx/scripts/export_word_pdf.ps1 +62 -0
- package/skills/scholar-thesis-docx/scripts/normalize_word_styles.ps1 +498 -0
- package/skills/scholar-thesis-docx/scripts/render_mermaid_figure.ps1 +148 -0
- package/skills/scholar-writing/SKILL.md +296 -0
- package/skills/security-audit/SKILL.md +244 -0
- package/skills/skill-generator/SKILL.md +472 -0
- package/skills/skill-iter-tune/SKILL.md +382 -0
- package/skills/skill-simplify/SKILL.md +63 -0
- package/skills/skill-tuning/SKILL.md +174 -0
- package/skills/spec-add/SKILL.md +105 -0
- package/skills/spec-load/SKILL.md +98 -0
- package/skills/spec-remove/SKILL.md +74 -0
- package/skills/spec-setup/SKILL.md +75 -0
- package/skills/team-adversarial-swarm/SKILL.md +233 -0
- package/skills/team-adversarial-swarm/scripts/__pycache__/pheromone.cpython-313.pyc +0 -0
- package/skills/team-adversarial-swarm/scripts/__pycache__/scoring.cpython-313.pyc +0 -0
- package/skills/team-adversarial-swarm/scripts/aco.py +473 -0
- package/skills/team-adversarial-swarm/scripts/pheromone.py +144 -0
- package/skills/team-adversarial-swarm/scripts/scoring.py +92 -0
- package/skills/team-adversarial-swarm/scripts/test_aco.py +475 -0
- package/skills/team-arch-opt/SKILL.md +158 -0
- package/skills/team-brainstorm/SKILL.md +171 -0
- package/skills/team-coordinate/SKILL.md +266 -0
- package/skills/team-designer/SKILL.md +160 -0
- package/skills/team-executor/SKILL.md +189 -0
- package/skills/team-frontend/SKILL.md +136 -0
- package/skills/team-frontend-debug/SKILL.md +198 -0
- package/skills/team-interactive-craft/SKILL.md +141 -0
- package/skills/team-issue/SKILL.md +171 -0
- package/skills/team-lifecycle-v4/SKILL.md +209 -0
- package/skills/team-motion-design/SKILL.md +142 -0
- package/skills/team-perf-opt/SKILL.md +175 -0
- package/skills/team-planex/SKILL.md +137 -0
- package/skills/team-quality-assurance/SKILL.md +147 -0
- package/skills/team-review/SKILL.md +147 -0
- package/skills/team-roadmap-dev/SKILL.md +169 -0
- package/skills/team-swarm/SKILL.md +178 -0
- package/skills/team-swarm/scripts/aco.py +473 -0
- package/skills/team-swarm/scripts/pheromone.py +144 -0
- package/skills/team-swarm/scripts/scoring.py +92 -0
- package/skills/team-swarm/scripts/test_aco.py +475 -0
- package/skills/team-tech-debt/SKILL.md +128 -0
- package/skills/team-testing/SKILL.md +143 -0
- package/skills/team-ui-polish/SKILL.md +141 -0
- package/skills/team-uidesign/SKILL.md +144 -0
- package/skills/team-ultra-analyze/SKILL.md +173 -0
- package/skills/team-ux-improve/SKILL.md +151 -0
- package/skills/team-visual-a11y/SKILL.md +156 -0
- package/skills/workflow-skill-designer/SKILL.md +496 -0
- package/src/extension/index.ts +222 -0
- package/src/extension/schemas.ts +131 -0
- package/src/providers/cli-tools-loader.ts +74 -0
- package/src/providers/provider-registry.ts +130 -0
- package/src/tools/delegate.ts +85 -0
- package/src/tools/explore.ts +134 -0
- package/src/tools/moa.ts +213 -0
- package/src/tools/status.ts +99 -0
- package/src/tools/wait.ts +166 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: manage-issue-discover
|
|
3
|
+
description: "Discover issues via multi-perspective analysis Arguments: [multi-perspective | by-prompt <prompt>] [-y] [--scope <glob>] [--depth standard|deep]"
|
|
4
|
+
allowed-tools: Read Write Edit Bash Glob Grep Agent AskUserQuestion
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<purpose>
|
|
8
|
+
Automated issue discovery: multi-perspective (8 perspectives) or prompt-driven. Deduplicates and records to `issues.jsonl`. For CRUD operations, use `/manage-issue`.
|
|
9
|
+
</purpose>
|
|
10
|
+
|
|
11
|
+
<required_reading>
|
|
12
|
+
@~/.maestro/workflows/issue-discover.md
|
|
13
|
+
</required_reading>
|
|
14
|
+
|
|
15
|
+
<deferred_reading>
|
|
16
|
+
- [issue.json template](~/.maestro/templates/issue.json) — read when creating issue records from findings (Step 6/11)
|
|
17
|
+
- [search-tools](~/.maestro/templates/search-tools.md) — search tool priority, passed to agents via workflow
|
|
18
|
+
</deferred_reading>
|
|
19
|
+
|
|
20
|
+
<context>
|
|
21
|
+
$ARGUMENTS -- optional. Parse first token to determine mode.
|
|
22
|
+
|
|
23
|
+
**Modes:**
|
|
24
|
+
- _(empty)_ -- interactive mode selection (AskUserQuestion)
|
|
25
|
+
- `multi-perspective` -- 8-perspective parallel agent scan
|
|
26
|
+
- `by-prompt "..."` -- prompt-driven iterative agent exploration (CLI-planned)
|
|
27
|
+
|
|
28
|
+
**Flags:**
|
|
29
|
+
- `-y` / `--yes` -- auto mode, skip confirmations
|
|
30
|
+
- `--scope=<pattern>` -- file scope (default: `**/*`)
|
|
31
|
+
- `--depth=standard|deep` -- exploration depth (by-prompt only, default: `standard`)
|
|
32
|
+
|
|
33
|
+
**State files:**
|
|
34
|
+
- `.workflow/issues/issues.jsonl` -- issues appended here (set `source: "discover"` on each row so concurrent writers like `manage-harvest` with `source: "harvest"` can be distinguished and deduplicated)
|
|
35
|
+
- `.workflow/issues/discoveries/{SESSION_ID}/` -- session artifacts
|
|
36
|
+
|
|
37
|
+
### Pre-load specs
|
|
38
|
+
1. **Debug specs**: Run `maestro load --type spec --category debug` to load known antipatterns, root causes, and gotchas. Informs discovery perspectives with prior findings.
|
|
39
|
+
2. Optional — proceed without if unavailable.
|
|
40
|
+
|
|
41
|
+
**Output boundary**: ALL file writes MUST target `.workflow/issues/issues.jsonl` or `.workflow/issues/discoveries/{SESSION_ID}/` only. NEVER modify source code or files outside these paths.
|
|
42
|
+
</context>
|
|
43
|
+
|
|
44
|
+
<invariants>
|
|
45
|
+
1. **Read-only analysis** — discovery agents MUST NOT modify source code; only `.workflow/issues/` is writable
|
|
46
|
+
2. **Source tagging** — MUST set `source: "discover"` on every issues.jsonl row so concurrent writers (e.g. `manage-harvest`) can be distinguished and deduplicated
|
|
47
|
+
3. **Dedup before write** — MUST check existing issues.jsonl for duplicates before appending new findings
|
|
48
|
+
4. **Session traceability** — every discovery run MUST produce a session directory under `.workflow/issues/discoveries/` with full agent outputs
|
|
49
|
+
5. **Schema compliance** — every issue row MUST conform to the canonical issue.json template schema
|
|
50
|
+
6. **Idempotent re-run** — repeated execution with same scope and prompt MUST NOT create duplicate issues
|
|
51
|
+
</invariants>
|
|
52
|
+
|
|
53
|
+
<execution>
|
|
54
|
+
Determine mode from $ARGUMENTS:
|
|
55
|
+
- No arguments or empty → interactive selection via AskUserQuestion
|
|
56
|
+
- First token is `multi-perspective` → multi-perspective mode
|
|
57
|
+
- First token is `by-prompt` → prompt-driven mode, remaining tokens are the user prompt
|
|
58
|
+
|
|
59
|
+
Follow '~/.maestro/workflows/issue-discover.md' completely.
|
|
60
|
+
|
|
61
|
+
### Phase Gates (MANDATORY, BLOCKING)
|
|
62
|
+
|
|
63
|
+
**GATE 1: Mode Selection → Analysis** (Steps 1-2 → Steps 3-8)
|
|
64
|
+
- REQUIRED: Mode correctly determined from arguments (multi-perspective or by-prompt).
|
|
65
|
+
- REQUIRED: `.workflow/issues/` directory exists (auto-create if missing).
|
|
66
|
+
- BLOCKED if E_NO_PROJECT (`.workflow/` missing) or E_EMPTY_PROMPT (by-prompt without text).
|
|
67
|
+
|
|
68
|
+
**GATE 2: Analysis → Issue Creation** (Steps 8-9 → Steps 10-11)
|
|
69
|
+
- REQUIRED: All perspectives analyzed (multi-perspective) or dimensions explored (by-prompt).
|
|
70
|
+
- REQUIRED: Findings deduplicated against existing issues.jsonl.
|
|
71
|
+
- BLOCKED if E_DISCOVERY_FAILED (all agents returned no results).
|
|
72
|
+
|
|
73
|
+
**GATE 3: Issue Creation → Completion** (Steps 11-12)
|
|
74
|
+
- REQUIRED: Issues appended to issues.jsonl with correct schema and `source: "discover"`.
|
|
75
|
+
- REQUIRED: Discovery session directory created with full agent outputs.
|
|
76
|
+
- BLOCKED if schema validation fails on any issue record.
|
|
77
|
+
</execution>
|
|
78
|
+
|
|
79
|
+
<error_codes>
|
|
80
|
+
| Code | Severity | Condition | Recovery |
|
|
81
|
+
|------|----------|-----------|----------|
|
|
82
|
+
| E_NO_PROJECT | error | `.workflow/` does not exist | Prompt user to run `/maestro-init` first |
|
|
83
|
+
| E_DISCOVERY_FAILED | error | CLI analysis returned no results | Retry with different tool or report partial findings |
|
|
84
|
+
| E_EMPTY_PROMPT | warning | `by-prompt` used without prompt text | Interactive prompt with suggested options |
|
|
85
|
+
</error_codes>
|
|
86
|
+
|
|
87
|
+
<success_criteria>
|
|
88
|
+
- [ ] Discovery mode correctly determined from arguments
|
|
89
|
+
- [ ] All perspectives analyzed (multi-perspective) or dimensions explored (by-prompt)
|
|
90
|
+
- [ ] Findings deduplicated before issue creation
|
|
91
|
+
- [ ] Issues appended to issues.jsonl with correct schema
|
|
92
|
+
- [ ] Discovery session fully traceable via session directory
|
|
93
|
+
- [ ] Next step routed
|
|
94
|
+
</success_criteria>
|
|
95
|
+
|
|
96
|
+
<completion>
|
|
97
|
+
### Next-step routing
|
|
98
|
+
|
|
99
|
+
| Condition | Suggestion |
|
|
100
|
+
|-----------|-----------|
|
|
101
|
+
| Issues discovered | `/manage-issue list` to review |
|
|
102
|
+
| Need root cause analysis | `/maestro-analyze --gaps <ISS-ID>` |
|
|
103
|
+
| Want to plan fixes | `/maestro-plan --gaps` |
|
|
104
|
+
</completion>
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: manage-kg-extractors
|
|
3
|
+
description: "Analyze codebase patterns and generate .workflow/kg/extractors.yaml for custom symbol extraction Arguments: [--scan-only] [--append] [--language <lang>] [--min-count <n>]"
|
|
4
|
+
allowed-tools: Read Write Edit Bash Glob Grep Agent AskUserQuestion
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<purpose>
|
|
8
|
+
Analyze current repository's code patterns to auto-generate `.workflow/kg/extractors.yaml` — a declarative config that teaches MaestroGraph's codegraph extractor to recognize project-specific symbols beyond standard function/class/method declarations.
|
|
9
|
+
</purpose>
|
|
10
|
+
|
|
11
|
+
<context>
|
|
12
|
+
$ARGUMENTS -- optional flags.
|
|
13
|
+
|
|
14
|
+
**Flags:**
|
|
15
|
+
- `--scan-only` — Only report detected patterns, don't write extractors.yaml
|
|
16
|
+
- `--append` — Append new rules to existing extractors.yaml (default: overwrite)
|
|
17
|
+
- `--language <lang>` — Limit analysis to specific language (python, typescript, java, etc.)
|
|
18
|
+
- `--min-count <n>` — Minimum occurrences to include a pattern (default: 3). Use `--min-count 1` to include rare patterns.
|
|
19
|
+
|
|
20
|
+
**Analysis targets (per language):**
|
|
21
|
+
|
|
22
|
+
| Language | Pattern Types |
|
|
23
|
+
|----------|--------------|
|
|
24
|
+
| Python | `define_*()` builder APIs, ALL_CAPS constants, `Final[...]` annotations, dataclass/pydantic fields |
|
|
25
|
+
| TypeScript | const enum, namespace exports, decorator factories, config objects |
|
|
26
|
+
| Java | static final constants, @Bean/@Component annotations, builder patterns |
|
|
27
|
+
| Go | exported constants (const blocks), interface registrations |
|
|
28
|
+
| All | Custom factory/builder call patterns with string-literal first args |
|
|
29
|
+
|
|
30
|
+
**Output:** `.workflow/kg/extractors.yaml` — declarative rules for PluginEngine.
|
|
31
|
+
|
|
32
|
+
**Output boundary**: ALL file writes MUST target `.workflow/kg/extractors.yaml` only. NEVER modify source code or files outside this path. `--scan-only` MUST NOT write any files.
|
|
33
|
+
|
|
34
|
+
**Rule format:**
|
|
35
|
+
```yaml
|
|
36
|
+
version: 1
|
|
37
|
+
defaults:
|
|
38
|
+
onError: warn
|
|
39
|
+
conflictPolicy: merge-metadata
|
|
40
|
+
plugins:
|
|
41
|
+
- id: <project>.<pattern>
|
|
42
|
+
languages: [<lang>]
|
|
43
|
+
mode: declarative
|
|
44
|
+
declarative:
|
|
45
|
+
rules:
|
|
46
|
+
- id: <rule-id>
|
|
47
|
+
match:
|
|
48
|
+
type: call | assignment | regex
|
|
49
|
+
pattern: "<pattern>"
|
|
50
|
+
nameRegex: "<optional filter>"
|
|
51
|
+
scope: module | class | any
|
|
52
|
+
extract:
|
|
53
|
+
kind: constant | variable | property | field
|
|
54
|
+
decorators: ["<semantic_tag>"]
|
|
55
|
+
metadata:
|
|
56
|
+
semanticKind: "<domain_kind>"
|
|
57
|
+
```
|
|
58
|
+
</context>
|
|
59
|
+
|
|
60
|
+
<execution>
|
|
61
|
+
|
|
62
|
+
<invariants>
|
|
63
|
+
1. **Read-only source code** — agents MUST only read source files for pattern discovery; NEVER modify source code
|
|
64
|
+
2. **Scan-only safety** — `--scan-only` MUST stop after Phase 2 summary; NEVER write extractors.yaml
|
|
65
|
+
3. **Append preservation** — `--append` MUST preserve existing rules in extractors.yaml; default (overwrite) MUST warn (W003) if file exists
|
|
66
|
+
4. **Min-count threshold** — patterns with fewer occurrences than `--min-count` MUST be excluded unless explicitly overridden
|
|
67
|
+
5. **User confirmation** — each pattern group MUST be confirmed/edited/skipped by user before writing (Phase 3, Step 2)
|
|
68
|
+
6. **Schema compliance** — generated extractors.yaml MUST conform to version 1 PluginEngine schema with required fields (id, languages, mode, rules)
|
|
69
|
+
7. **Validation mandatory** — MUST run `maestro kg index` after writing to verify new symbols are extractable
|
|
70
|
+
</invariants>
|
|
71
|
+
|
|
72
|
+
### Phase 1: Discover patterns
|
|
73
|
+
|
|
74
|
+
Spawn **3 parallel agents** to scan the codebase:
|
|
75
|
+
|
|
76
|
+
| Agent | Focus | Method |
|
|
77
|
+
|-------|-------|--------|
|
|
78
|
+
| Agent 1 | **Builder/factory calls** | Grep for patterns like `define_*("`, `register_*("`, `add_*("` where first arg is a string literal |
|
|
79
|
+
| Agent 2 | **Constants & annotations** | Grep for ALL_CAPS assignments, Final[], static final, const enum, exported const |
|
|
80
|
+
| Agent 3 | **Framework patterns** | Detect framework (from package.json/setup.py/go.mod) → grep framework-specific registration patterns |
|
|
81
|
+
|
|
82
|
+
Each agent returns: `[{pattern_type, regex_evidence, file_count, sample_matches: [{file, line, code}]}]`
|
|
83
|
+
|
|
84
|
+
### Phase Gates (MANDATORY, BLOCKING)
|
|
85
|
+
|
|
86
|
+
**GATE 1: Discovery → Generation** (Phase 1 → Phase 2)
|
|
87
|
+
- REQUIRED: At least 1 of 3 agents returned valid pattern results.
|
|
88
|
+
- BLOCKED if all 3 agents return empty results (E002).
|
|
89
|
+
|
|
90
|
+
**GATE 2: Generation → Write** (Phase 2 → Phase 3)
|
|
91
|
+
- REQUIRED: At least 1 pattern meets `--min-count` threshold.
|
|
92
|
+
- REQUIRED: User confirmed pattern groups via AskUserQuestion.
|
|
93
|
+
- BLOCKED if `--scan-only` is set — stop after summary.
|
|
94
|
+
|
|
95
|
+
**GATE 3: Write → Validation** (Phase 3 → KG Index)
|
|
96
|
+
- REQUIRED: extractors.yaml written with valid schema.
|
|
97
|
+
- REQUIRED: `maestro kg index` executed to verify extraction.
|
|
98
|
+
- BLOCKED if schema validation fails on generated YAML.
|
|
99
|
+
|
|
100
|
+
### Phase 2: Generate rules
|
|
101
|
+
|
|
102
|
+
For each discovered pattern with ≥3 occurrences:
|
|
103
|
+
1. Determine match type (call/assignment/regex)
|
|
104
|
+
2. Build pattern string and optional nameRegex
|
|
105
|
+
3. Assign appropriate kind and semanticKind
|
|
106
|
+
4. Generate rule entry
|
|
107
|
+
|
|
108
|
+
### Phase 3: Validate & write
|
|
109
|
+
|
|
110
|
+
1. Show discovered patterns summary to user
|
|
111
|
+
2. AskUserQuestion: confirm/edit/skip each pattern group
|
|
112
|
+
3. Write `.workflow/kg/extractors.yaml`
|
|
113
|
+
4. Run `maestro kg index` to verify new symbols are extracted
|
|
114
|
+
|
|
115
|
+
If `--scan-only`: stop after Phase 2 summary.
|
|
116
|
+
|
|
117
|
+
</execution>
|
|
118
|
+
|
|
119
|
+
<completion>
|
|
120
|
+
### Next-step routing
|
|
121
|
+
|
|
122
|
+
| Condition | Suggestion |
|
|
123
|
+
|-----------|-----------|
|
|
124
|
+
| Verify new symbols | `maestro search --kg "<pattern_name>"` |
|
|
125
|
+
| Re-index after changes | `maestro kg index` |
|
|
126
|
+
| View KG stats | `maestro kg stats` |
|
|
127
|
+
| Edit rules manually | Edit `.workflow/kg/extractors.yaml` |
|
|
128
|
+
| Add script plugin | Create `.workflow/kg/extractors/<name>.mjs` |
|
|
129
|
+
</completion>
|
|
130
|
+
|
|
131
|
+
<error_codes>
|
|
132
|
+
| Code | Severity | Condition | Recovery |
|
|
133
|
+
|------|----------|-----------|----------|
|
|
134
|
+
| E001 | error | .workflow/ not initialized | Run maestro-init first |
|
|
135
|
+
| E002 | error | All 3 Phase 1 agents failed — zero patterns discovered | Check codebase language detection; retry with `--language` |
|
|
136
|
+
| W001 | warning | No patterns detected for language | Try broader scan or different language |
|
|
137
|
+
| W002 | warning | Pattern has < 3 occurrences | Skipped by default, include with --min-count 1 |
|
|
138
|
+
| W003 | warning | Existing extractors.yaml will be overwritten | Use --append to preserve |
|
|
139
|
+
</error_codes>
|
|
140
|
+
|
|
141
|
+
<success_criteria>
|
|
142
|
+
- [ ] At least 1 pattern detected in the codebase
|
|
143
|
+
- [ ] extractors.yaml generated with valid rules
|
|
144
|
+
- [ ] Each rule has match.type, match.pattern, extract.kind
|
|
145
|
+
- [ ] Re-index succeeds with new extractors.yaml active
|
|
146
|
+
- [ ] New symbols searchable via `maestro search --kg`
|
|
147
|
+
</success_criteria>
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: manage-knowhow
|
|
3
|
+
description: "Manage knowhow entries (workflow and system) Arguments: <subcommand: list|search|view|edit|delete|prune> [query|id] [--store workflow|system|all] [--tag <tag>] [--type compact|tip]"
|
|
4
|
+
allowed-tools: Read Write Edit Bash Glob Grep AskUserQuestion
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<purpose>
|
|
8
|
+
Manage knowhow across two stores: workflow (`.workflow/knowhow/`) and system memory (`~/.claude/projects/*/memory/`). Operations: list, search, view, edit, delete, prune.
|
|
9
|
+
</purpose>
|
|
10
|
+
|
|
11
|
+
<required_reading>
|
|
12
|
+
@~/.maestro/workflows/knowhow.md
|
|
13
|
+
</required_reading>
|
|
14
|
+
|
|
15
|
+
<context>
|
|
16
|
+
Arguments: $ARGUMENTS
|
|
17
|
+
|
|
18
|
+
Dual store architecture (paths, formats, index) defined in workflow knowhow.md.
|
|
19
|
+
|
|
20
|
+
**Output boundary**: Workflow store writes MUST target `.workflow/knowhow/` only. System store writes MUST target `~/.claude/projects/*/memory/` only. NEVER modify source code or files outside these paths.
|
|
21
|
+
|
|
22
|
+
**Subcommands:**
|
|
23
|
+
- `list` — List entries from both stores (default if no arguments)
|
|
24
|
+
- `search <query>` — Full-text search across both stores
|
|
25
|
+
- `view <id|file>` — Display a workflow entry by ID or system file by name
|
|
26
|
+
- `edit <file>` — Edit a system memory file (MEMORY.md or topic file)
|
|
27
|
+
- `delete <id|file>` — Remove an entry/file (with confirmation)
|
|
28
|
+
- `prune` — Bulk cleanup by criteria
|
|
29
|
+
|
|
30
|
+
**Flags:**
|
|
31
|
+
- `--store <workflow|system|all>` — Target store (default: `all` for list/search, inferred for other ops)
|
|
32
|
+
- `--tag <tag>` — Filter by tag (workflow store)
|
|
33
|
+
- `--type <compact|tip>` — Filter by entry type (workflow store)
|
|
34
|
+
- `--before <YYYY-MM-DD>` — Entries before date
|
|
35
|
+
- `--after <YYYY-MM-DD>` — Entries after date
|
|
36
|
+
- `--dry-run` — Preview destructive ops without executing
|
|
37
|
+
- `--confirm` — Skip confirmation prompt
|
|
38
|
+
</context>
|
|
39
|
+
|
|
40
|
+
<execution>
|
|
41
|
+
Follow '~/.maestro/workflows/knowhow.md' Part A (KnowHow Management) completely.
|
|
42
|
+
|
|
43
|
+
### Phase Gates (MANDATORY, BLOCKING)
|
|
44
|
+
|
|
45
|
+
**GATE 1: Parse → Execute** (Subcommand routing)
|
|
46
|
+
- REQUIRED: Subcommand parsed from first token (list/search/view/edit/delete/prune).
|
|
47
|
+
- REQUIRED: Both store paths resolved (workflow + system).
|
|
48
|
+
- BLOCKED if E001 (no memory stores found) or invalid subcommand.
|
|
49
|
+
|
|
50
|
+
**GATE 2: Execute → Mutate** (For destructive subcommands: delete/prune/edit)
|
|
51
|
+
- REQUIRED: Target entry/file resolved and exists (E002 if not found).
|
|
52
|
+
- REQUIRED: MEMORY.md protected from deletion (E004 — use `edit` instead).
|
|
53
|
+
- REQUIRED: For `prune`: at least one filter provided (E003).
|
|
54
|
+
- REQUIRED: User confirmation before delete/prune unless `--confirm` flag set.
|
|
55
|
+
- BLOCKED if target unresolvable or confirmation denied.
|
|
56
|
+
</execution>
|
|
57
|
+
|
|
58
|
+
<invariants>
|
|
59
|
+
1. **MEMORY.md protected** — NEVER delete MEMORY.md; only editable via `edit` subcommand
|
|
60
|
+
2. **MEMORY.md line limit** — MUST warn (W003) when MEMORY.md exceeds 200 lines; content beyond 200 lines will be truncated at load
|
|
61
|
+
3. **Confirmation on destructive ops** — `delete` and `prune` MUST require user confirmation unless `--confirm` flag is set
|
|
62
|
+
4. **Store isolation** — `prune` operates on workflow store only; NEVER prune system memory files
|
|
63
|
+
5. **Reference integrity** — `delete` MUST check for references from other entries before removing; warn if orphaned references would result
|
|
64
|
+
6. **Dry-run safety** — `--dry-run` MUST NOT write any files; preview destructive operations only
|
|
65
|
+
7. **Index consistency** — after delete/prune, workflow index MUST be updated to reflect removals
|
|
66
|
+
</invariants>
|
|
67
|
+
|
|
68
|
+
<error_codes>
|
|
69
|
+
| Code | Severity | Description | Stage |
|
|
70
|
+
|------|----------|-------------|-------|
|
|
71
|
+
| E001 | error | No memory stores found — for workflow store run `/manage-knowhow-capture`; for system store create `~/.claude/projects/{project}/memory/MEMORY.md` manually | resolve_paths |
|
|
72
|
+
| E002 | error | Entry ID or filename not found | execute_view, execute_delete |
|
|
73
|
+
| E003 | error | Prune requires at least one filter (--tag, --type, --before, --after) | execute_prune |
|
|
74
|
+
| E004 | error | Cannot delete MEMORY.md — use `edit` subcommand instead | execute_delete |
|
|
75
|
+
| W001 | warning | Workflow index has orphaned files or dangling references | integrity_check |
|
|
76
|
+
| W002 | warning | MEMORY.md references non-existent topic file | integrity_check |
|
|
77
|
+
| W003 | warning | MEMORY.md exceeds 200 lines — content will be truncated at load | execute_edit |
|
|
78
|
+
</error_codes>
|
|
79
|
+
|
|
80
|
+
<success_criteria>
|
|
81
|
+
- [ ] Both store paths correctly resolved
|
|
82
|
+
- [ ] Subcommand correctly detected from arguments
|
|
83
|
+
- [ ] Store auto-detected from argument format (KNW-*/TIP-* vs filename)
|
|
84
|
+
- [ ] List: both stores displayed with appropriate formatting
|
|
85
|
+
- [ ] Search: results from both stores, ranked by relevance
|
|
86
|
+
- [ ] View: correct store selected, full content displayed
|
|
87
|
+
- [ ] Edit: system memory files editable, MEMORY.md kept under 200 lines
|
|
88
|
+
- [ ] Delete: MEMORY.md protected, confirmation required, references checked
|
|
89
|
+
- [ ] Prune: workflow-only, filters validated, index updated
|
|
90
|
+
- [ ] Integrity check catches orphans and broken links
|
|
91
|
+
- [ ] Next step routed
|
|
92
|
+
</success_criteria>
|
|
93
|
+
|
|
94
|
+
<completion>
|
|
95
|
+
### Next-step routing
|
|
96
|
+
|
|
97
|
+
| Condition | Suggestion |
|
|
98
|
+
|-----------|-----------|
|
|
99
|
+
| Want to capture new knowhow | `/manage-knowhow-capture` |
|
|
100
|
+
| View project state | `/manage-status` |
|
|
101
|
+
| Prune stale entries | `/manage-knowledge-audit --scope knowhow` |
|
|
102
|
+
</completion>
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: manage-knowhow-capture
|
|
3
|
+
description: "Capture reusable knowledge as templates, recipes, or tips Arguments: [<type>] [<description>] [--lang <lang>] [--source <url>] [--tag t1,t2]"
|
|
4
|
+
allowed-tools: Read Write Edit Bash Glob Grep WebFetch AskUserQuestion
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<purpose>
|
|
8
|
+
Capture reusable knowledge into `.workflow/knowhow/` with type-specific structured fields.
|
|
9
|
+
Auto-indexed by WikiIndexer (type=knowhow), searchable via `maestro search --type knowhow`.
|
|
10
|
+
</purpose>
|
|
11
|
+
|
|
12
|
+
<required_reading>
|
|
13
|
+
@~/.maestro/workflows/knowhow.md
|
|
14
|
+
</required_reading>
|
|
15
|
+
|
|
16
|
+
<context>
|
|
17
|
+
$ARGUMENTS — type token + description + optional flags.
|
|
18
|
+
|
|
19
|
+
**Flags**: `--lang <lang>`, `--source <url>`, `--tag tag1,tag2`, `--title <title>`, `--description <desc>`, `--asset-type <type>`, `--code-paths <paths>`, `--category <cat>`
|
|
20
|
+
|
|
21
|
+
**Type routing** (first token match):
|
|
22
|
+
|
|
23
|
+
| Token | Type | Prefix | Key fields |
|
|
24
|
+
|-------|------|--------|------------|
|
|
25
|
+
| `compact`/`session`/`压缩`/`保存` | compact | KNW- | objective, files, decisions, plan, pending |
|
|
26
|
+
| `template`/`tpl`/`模板` | template | TPL- | language, code block, usage, parameters |
|
|
27
|
+
| `recipe`/`rcp`/`配方`/`步骤` | recipe | RCP- | prerequisites, steps, expected outcome, pitfalls |
|
|
28
|
+
| `reference`/`ref`/`参考`/`引用` | reference | REF- | source URL, key points, scenarios, examples |
|
|
29
|
+
| `decision`/`dcs`/`决策`/`adr` | decision | DCS- | context, alternatives table, rationale, consequences |
|
|
30
|
+
| `tip`/`note`/`记录`/`快速` | tip | TIP- | content, tags |
|
|
31
|
+
| `asset`/`ast`/`资产`/`契约` | asset | AST- | assetType, codePaths, category |
|
|
32
|
+
| `blueprint`/`blp`/`蓝图` | blueprint | BLP- | codePaths, category |
|
|
33
|
+
| `document`/`doc`/`文档` | document | DOC- | (general fallback) |
|
|
34
|
+
| `insight`/`ins`/`洞察`/`经验` | insight | INS- | content, tags, phase (replaces former manage-learn) |
|
|
35
|
+
| Short text + `--tag` | tip | TIP- | — |
|
|
36
|
+
| No args | — | — | AskUserQuestion (10 options) |
|
|
37
|
+
|
|
38
|
+
**Output**: `.workflow/knowhow/{PREFIX}-{YYYYMMDD}-{slug}.md` with YAML frontmatter (title, description, type, category, created, tags, source, lang, status)
|
|
39
|
+
|
|
40
|
+
**Output boundary**: ALL file writes MUST target `.workflow/knowhow/` only. NEVER modify source code or files outside this path.
|
|
41
|
+
</context>
|
|
42
|
+
|
|
43
|
+
<invariants>
|
|
44
|
+
1. **Description required** — every entry MUST have a `description` field in frontmatter (under 120 chars) for search indexing
|
|
45
|
+
2. **Tags language match** — tags MUST match content language (Chinese content → Chinese tags, English → English)
|
|
46
|
+
3. **ID uniqueness** — generated file names ({PREFIX}-{YYYYMMDD}-{slug}.md) MUST be unique; NEVER overwrite existing entries
|
|
47
|
+
4. **Frontmatter completeness** — YAML frontmatter MUST include: title, description, type, category, created, tags, status
|
|
48
|
+
5. **Type-specific validation** — each type MUST populate all its required fields before writing (template needs code block, recipe needs steps, etc.)
|
|
49
|
+
6. **Idempotent naming** — same content captured twice MUST produce same slug, enabling dedup detection
|
|
50
|
+
</invariants>
|
|
51
|
+
|
|
52
|
+
<execution>
|
|
53
|
+
Follow '~/.maestro/workflows/knowhow.md' completely.
|
|
54
|
+
|
|
55
|
+
### Phase Gates (MANDATORY, BLOCKING)
|
|
56
|
+
|
|
57
|
+
**GATE 1: Type Detection → Content Collection** (Type routing → Content extraction)
|
|
58
|
+
- REQUIRED: Type detected from first token or selected via AskUserQuestion.
|
|
59
|
+
- REQUIRED: Type maps to a valid prefix (KNW-/TPL-/RCP-/REF-/DCS-/TIP-/AST-/BLP-/DOC-/INS-).
|
|
60
|
+
- BLOCKED if type unresolvable after interactive prompt.
|
|
61
|
+
|
|
62
|
+
**GATE 2: Content Collection → Write** (Content extraction → File write)
|
|
63
|
+
- REQUIRED: All type-specific required fields populated (e.g., template needs code block, recipe needs steps).
|
|
64
|
+
- REQUIRED: `description` field generated or provided (under 120 chars).
|
|
65
|
+
- REQUIRED: Tags generated in correct language matching content.
|
|
66
|
+
- BLOCKED if required fields missing after user prompt (E002/E003).
|
|
67
|
+
|
|
68
|
+
**Description rule**: Every entry MUST have a `description` field in frontmatter — a one-line summary (under 120 chars) for search results. WikiIndexer uses priority chain: `description > content[:240]`. Use `--description` flag value if provided; otherwise auto-generate from content.
|
|
69
|
+
|
|
70
|
+
**Tags language rule**: Tags must match content language. Chinese content → Chinese tags (如 `认证,令牌,刷新`). English content → English tags. Mixed → bilingual.
|
|
71
|
+
|
|
72
|
+
**Type-specific content rules**:
|
|
73
|
+
|
|
74
|
+
| Type | Content extraction |
|
|
75
|
+
|------|-------------------|
|
|
76
|
+
| compact | Extract from conversation: session ID, objective, execution plan (verbatim), working files (3-8), decisions, constraints, pending. Plan priority: workflow IMPL_PLAN.md > TodoWrite > user-stated > inferred. |
|
|
77
|
+
| template | Ask for: language, code block, parameters (placeholders), usage context, dependencies |
|
|
78
|
+
| recipe | Ask for: goal, prerequisites, numbered steps, expected outcome, common pitfalls |
|
|
79
|
+
| reference | From --source URL or ask. Key points, applicable scenarios, quick examples. Offer WebFetch if URL provided. |
|
|
80
|
+
| decision | Context, alternatives (table: alt/pros/cons/rejected-because), rationale, consequences. Status: proposed/accepted/superseded. |
|
|
81
|
+
| tip | Content = everything after type token. Auto-detect context from recent files. |
|
|
82
|
+
| asset | assetType (api-contract/data-model/prompt/config), codePaths, category for agent discovery |
|
|
83
|
+
| blueprint | Architecture design with codePaths and category |
|
|
84
|
+
</execution>
|
|
85
|
+
|
|
86
|
+
<error_codes>
|
|
87
|
+
| Code | Condition | Recovery |
|
|
88
|
+
|------|-----------|----------|
|
|
89
|
+
| E002 | Template: no code provided after prompt | Ask again or cancel |
|
|
90
|
+
| E003 | Recipe: no steps provided after prompt | Ask again or cancel |
|
|
91
|
+
| W001 | No active workflow session (compact) | Captures conversation only |
|
|
92
|
+
| W002 | Plan detection found no explicit plan (compact) | Uses inferred plan |
|
|
93
|
+
</error_codes>
|
|
94
|
+
|
|
95
|
+
<success_criteria>
|
|
96
|
+
- [ ] Type detected or selected, all type-specific fields populated
|
|
97
|
+
- [ ] File written to .workflow/knowhow/ with correct prefix and YAML frontmatter
|
|
98
|
+
- [ ] Confirmation displayed with ID, type, path
|
|
99
|
+
</success_criteria>
|
|
100
|
+
|
|
101
|
+
<completion>
|
|
102
|
+
### Next-step routing
|
|
103
|
+
|
|
104
|
+
| Condition | Suggestion |
|
|
105
|
+
|-----------|-----------|
|
|
106
|
+
| Entry captured | `/manage-knowhow list` to view library |
|
|
107
|
+
| Want to connect entries | `/manage-wiki connect` |
|
|
108
|
+
| Want to bridge to specs | `/spec-add <category>` with `--spec-category` |
|
|
109
|
+
</completion>
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: manage-knowledge-audit
|
|
3
|
+
description: "Audit and prune knowledge across spec / knowhow / artifact stores Arguments: --scope <spec|knowhow|artifact|all> [--level P0|P1|P2] [--timeline T1..T6] [--since YYYY-MM-DD] [--milestone <name>] [--include-archive] [--interactive] [--mark|--delete|--purge] [--dry-run] [--report]"
|
|
4
|
+
allowed-tools: Read Write Edit Bash Glob Grep Agent AskUserQuestion
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<purpose>
|
|
8
|
+
审查 spec/knowhow/artifact 存储,识别矛盾/失效/孤儿,通过 keep/deprecate/delete 三态清理。对称于 `manage-harvest`(写入入口)。
|
|
9
|
+
</purpose>
|
|
10
|
+
|
|
11
|
+
<required_reading>
|
|
12
|
+
@~/.maestro/workflows/knowledge-audit.md
|
|
13
|
+
</required_reading>
|
|
14
|
+
|
|
15
|
+
<deferred_reading>
|
|
16
|
+
- @~/.maestro/workflows/harvest.md (audit 检测的 artifact 是 harvest 的产物源)
|
|
17
|
+
- @~/.maestro/workflows/specs-add.md (deprecate 操作所需的 `<spec-entry>` 变形)
|
|
18
|
+
</deferred_reading>
|
|
19
|
+
|
|
20
|
+
<context>
|
|
21
|
+
Arguments: $ARGUMENTS
|
|
22
|
+
|
|
23
|
+
**Scope(必选):** `spec` | `knowhow` | `artifact` | `all`
|
|
24
|
+
|
|
25
|
+
**删除策略**默认 `--interactive`(三态面板逐项决策);非交互模式 `--mark`(仅打标)/ `--delete`(软删到 `.trash/`)/ `--purge`(物理擦除,仅 artifact 且需双重确认)。
|
|
26
|
+
|
|
27
|
+
**互斥规则:** `--interactive`、`--mark`、`--delete`、`--purge` 四选一,同时传入多个 → E006。
|
|
28
|
+
|
|
29
|
+
Flag 全集、scope 对应的扫描路径、Stage 步骤、检测算法定义在 workflow knowledge-audit.md。
|
|
30
|
+
|
|
31
|
+
**Output boundary**: ALL file writes MUST target `.workflow/specs/`, `.workflow/knowhow/`, `.workflow/.trash/knowledge-audit-{timestamp}/`, `.workflow/issues/`, or audit report files (`audit-report-*.md`, `audit-log.jsonl`). NEVER modify source code files.
|
|
32
|
+
</context>
|
|
33
|
+
|
|
34
|
+
<invariants>
|
|
35
|
+
1. **Code-as-Truth** — 代码是唯一真理源;spec/knowhow 声明 MUST 与代码实际行为一致;每个 finding 的 evidence MUST 包含代码引用(文件:行号)
|
|
36
|
+
2. **Backup before mutate** — MUST create backup tarball in `.workflow/.trash/` before any file modification (E005 if backup fails)
|
|
37
|
+
3. **Deprecate over delete** — 文本存储首选 `status="deprecated"` 保留历史;NEVER 物理删除 spec/knowhow 文件
|
|
38
|
+
4. **Purge 仅 artifact** — `--purge` MUST NOT 作用于 spec/knowhow scope (E004)
|
|
39
|
+
5. **Rescue before delete** — 未 harvest 的 artifact 删除前 MUST 强制提示先跑 `/manage-harvest` (W002)
|
|
40
|
+
6. **Conflict marker sync** — deprecate/delete 执行时如果目标条目有 conflict-marker,MUST 同步调用 `maestro spec conflict clear` 清除标记
|
|
41
|
+
7. **Mutual exclusion** — `--interactive`/`--mark`/`--delete`/`--purge` 四选一;同时传入多个 MUST trigger E006
|
|
42
|
+
8. **Dry-run safety** — `--dry-run` MUST NOT write any files; `--purge` 与 `--dry-run` 互斥 (E003)
|
|
43
|
+
</invariants>
|
|
44
|
+
|
|
45
|
+
<execution>
|
|
46
|
+
Follow `~/.maestro/workflows/knowledge-audit.md` Stages 1-8 in order.
|
|
47
|
+
|
|
48
|
+
### Phase Gates (MANDATORY, BLOCKING)
|
|
49
|
+
|
|
50
|
+
**GATE 1: Load → Detect** (Stages 1-2 → Stage 4)
|
|
51
|
+
- REQUIRED: Scope 解析通过,互斥标志校验完成。
|
|
52
|
+
- REQUIRED: 三存储按 scope 加载完成。
|
|
53
|
+
- REQUIRED: 加载已有冲突标记: `maestro spec conflict list` → 合并到 finding 池。
|
|
54
|
+
- BLOCKED if scope 非法或存储不可读: E001/E002。
|
|
55
|
+
|
|
56
|
+
**GATE 2: Detect → Decision** (Stage 4 → Stage 5)
|
|
57
|
+
- REQUIRED: Finding 池按 P0/P1/P2 分级输出。
|
|
58
|
+
- REQUIRED: 已标记 `contested` 的条目自动归入 P0 finding(来源: conflict-marker)。
|
|
59
|
+
- REQUIRED: 未 harvest 的 artifact 删除前触发抢救确认(W002)。
|
|
60
|
+
- BLOCKED if finding 为空: 无需淘汰,直接输出报告。
|
|
61
|
+
|
|
62
|
+
**GATE 3: Decision → Mutate** (Stage 5 → Stage 6-7)
|
|
63
|
+
- REQUIRED: Backup tarball 生成于 `.workflow/.trash/knowledge-audit-{timestamp}/`。
|
|
64
|
+
- REQUIRED: 备份成功后方可执行变更。
|
|
65
|
+
- REQUIRED: `--purge` 需双重确认(仅 artifact scope)。
|
|
66
|
+
- BLOCKED if 备份失败: E005,禁止执行变更。
|
|
67
|
+
|
|
68
|
+
### Execution Constraints
|
|
69
|
+
|
|
70
|
+
- **Deprecate over delete**: 文本存储首选 `status="deprecated"`,保留历史。
|
|
71
|
+
- **Purge 仅 artifact**: `--purge` 不作用于 spec/knowhow。
|
|
72
|
+
- **Rescue before delete**: 未抽取 artifact 删除前强制提示先 `/manage-harvest`。
|
|
73
|
+
|
|
74
|
+
### Conflict Resolution Integration
|
|
75
|
+
|
|
76
|
+
五态决策(扩展自三态 keep/deprecate/delete):
|
|
77
|
+
|
|
78
|
+
| 动作 | 适用场景 | 执行 |
|
|
79
|
+
|------|---------|------|
|
|
80
|
+
| `keep` | 内容正确,无需变更 | 写 audit-log ignore 记录 |
|
|
81
|
+
| `contest` | 矛盾真实存在,需进一步审查 | `maestro spec conflict mark <file> <line> --note "<evidence>"` |
|
|
82
|
+
| `supersede` | 内容过时,已有更新版本替代 | `maestro spec supersede <old-sid> --by <new-sid>`(保留演化链) |
|
|
83
|
+
| `deprecate` | 内容过时,无替代版本 | 注入 `status="deprecated"` + `maestro spec conflict clear <file> <line>` |
|
|
84
|
+
| `delete` | 内容明确错误 | 移除 entry + `maestro spec conflict clear <file> <line>` |
|
|
85
|
+
|
|
86
|
+
**supersede vs deprecate**: supersede 用于有明确替代条目的场景(建立演化链),deprecate 用于无替代条目的场景。
|
|
87
|
+
**关键**: deprecate/delete 执行时,如果目标条目有 conflict-marker,必须同步调用 `maestro spec conflict clear` 清除标记,避免悬空冲突。
|
|
88
|
+
|
|
89
|
+
### Code-as-Truth 校验(审查核心原则)
|
|
90
|
+
|
|
91
|
+
**代码是唯一真理源。** Spec/knowhow 中的任何声明,必须与代码实际行为一致。
|
|
92
|
+
|
|
93
|
+
当 detector 发现 spec 条目声称某行为/规则时:
|
|
94
|
+
1. **代码校验**: grep/read 代码中相关实现,确认 spec 声明是否与代码一致
|
|
95
|
+
2. **不一致处理**:
|
|
96
|
+
- 代码正确、spec 过时 → `deprecate` 或 `delete` spec 条目
|
|
97
|
+
- 代码正确、spec 不完整 → `contest` 并建议补充
|
|
98
|
+
- 代码有 bug、spec 正确 → `keep` spec,生成 issue 修代码
|
|
99
|
+
3. **禁止**: 仅凭 spec 文本判断正确性。每个 finding 的 evidence 必须包含代码引用(文件:行号)
|
|
100
|
+
</execution>
|
|
101
|
+
|
|
102
|
+
<completion>
|
|
103
|
+
### Next-step routing
|
|
104
|
+
|
|
105
|
+
| Condition | Suggestion |
|
|
106
|
+
|-----------|-----------|
|
|
107
|
+
| 复审淘汰记录 | 查看 `audit-report-{date}.md` |
|
|
108
|
+
| 抢救未抽取 artifact | `/manage-harvest <artifact-id>` |
|
|
109
|
+
| 验证 spec 现状 | `maestro load --type spec` |
|
|
110
|
+
| 查看冲突标记 | `maestro spec conflict list` |
|
|
111
|
+
| 清除已解决冲突 | `maestro spec conflict clear-all <file>` |
|
|
112
|
+
| 查看演化链 | `maestro spec history <sid>` |
|
|
113
|
+
| 知识健康检查 | `maestro spec health` |
|
|
114
|
+
| 回填存量 sid | `maestro spec backfill-sid` |
|
|
115
|
+
| 周期巡检 | `--scope all --report` |
|
|
116
|
+
</completion>
|
|
117
|
+
|
|
118
|
+
<error_codes>
|
|
119
|
+
| Code | Severity | Condition | Recovery |
|
|
120
|
+
|------|----------|-----------|----------|
|
|
121
|
+
| E001 | error | `.workflow/` 未初始化 | 先跑 `/maestro-init` |
|
|
122
|
+
| E002 | error | `--scope` 缺失或非法 | 提供 spec/knowhow/artifact/all |
|
|
123
|
+
| E003 | error | `--purge` 与 `--dry-run` 同用 | 二选一 |
|
|
124
|
+
| E004 | error | `--purge` 作用于非 artifact 范围 | purge 仅支持 artifact scope |
|
|
125
|
+
| E005 | error | 备份失败(`.trash/` 写入异常) | 检查磁盘空间与权限,重试 |
|
|
126
|
+
| E006 | error | `--interactive`/`--mark`/`--delete`/`--purge` 同时传入多个 | 四选一,默认 `--interactive` |
|
|
127
|
+
| W001 | warning | 检出冲突但用户选择 keep | 记入 report,不阻断 |
|
|
128
|
+
| W002 | warning | 待删 artifact 无 harvest-log 记录 | 提示先跑 manage-harvest |
|
|
129
|
+
| W003 | warning | 循环 supersedes 链 | 自动断环或交互选保留节点 |
|
|
130
|
+
| W004 | warning | 检测耗时 >120s(大规模 spec 库) | 建议加 `--scope` 收敛或 `--since` 增量 |
|
|
131
|
+
| W005 | warning | LLM detector 不可用 | 降级到正则+图算法子集,跳过 B/G 类语义场景 |
|
|
132
|
+
</error_codes>
|
|
133
|
+
|
|
134
|
+
<success_criteria>
|
|
135
|
+
- [ ] Scope 正确解析,互斥标志校验通过
|
|
136
|
+
- [ ] 三存储按 scope 加载完成,构建出统一 finding 池
|
|
137
|
+
- [ ] Stage 3 时间线索引建立(mtime ↔ session/milestone 状态)
|
|
138
|
+
- [ ] Stage 4 按 P0/P1/P2 输出 finding 列表
|
|
139
|
+
- [ ] 如非 `--report`:用户对每项做出三态决策
|
|
140
|
+
- [ ] 未 harvest 的 artifact 删除前触发抢救确认
|
|
141
|
+
- [ ] Stage 6 backup tarball 生成于 `.workflow/.trash/`
|
|
142
|
+
- [ ] `deprecate` 通过元数据注入完成(spec/knowhow 文件未被物理删除)
|
|
143
|
+
- [ ] `delete` 移动至 `.trash/`,索引同步更新
|
|
144
|
+
- [ ] `purge` 仅在双重确认通过后执行
|
|
145
|
+
- [ ] `audit-report-{date}.md` + `audit-log.jsonl` 写入完成
|
|
146
|
+
- [ ] 摘要展示三存储变更计数与下一步路由
|
|
147
|
+
</success_criteria>
|