Skip to content
This repository was archived by the owner on Apr 11, 2026. It is now read-only.

Commit d7e9de5

Browse files
z23ccclaude
andcommitted
feat: memory type classification + auto-capture pitfalls on NEEDS_WORK
- flowctl memory add --type pitfall|convention|decision|general (default: general) - flowctl memory list --type <filter> to show entries by type - impl_review auto-captures pitfall when review returns NEEDS_WORK - Worker Phase 6 records pitfalls from self-review fixes - Worker Phase 10 uses typed entries (pitfall/convention/decision/general) - Code review skill auto-captures Critical/Important findings as pitfalls - Brainstorm step-02 reads pitfall memory to avoid known failure patterns - Backward compatible: existing entries without type default to general Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 887c5ce commit d7e9de5

6 files changed

Lines changed: 35 additions & 8 deletions

File tree

agents/worker.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,11 @@ Also check:
574574

575575
If you find issues, fix them and re-run `<FLOWCTL> guard` to verify.
576576

577+
If self-review finds issues that required fixes, record as pitfall:
578+
```bash
579+
<FLOWCTL> memory add pitfall "Self-review: <what was wrong>"
580+
```
581+
577582
**Rules:**
578583
- Only fix issues in YOUR changes — don't refactor unrelated code
579584
- If unsure whether something is an issue, leave it for Phase 8 (external review)
@@ -782,6 +787,13 @@ If enabled, reflect on what you discovered during implementation and save **only
782787
<FLOWCTL> memory add decision "What was decided and why"
783788
```
784789

790+
- **General**: Observations that don't fit the above categories
791+
```bash
792+
<FLOWCTL> memory add general "Observation description"
793+
```
794+
795+
Use the most specific type: failure patterns → `pitfall`, project conventions → `convention`, architecture choices → `decision`, everything else → `general`.
796+
785797
**Rules:**
786798
- Only save if you genuinely discovered something non-obvious
787799
- Don't repeat what's already in the spec or README

bin/flowctl

16 Bytes
Binary file not shown.

flowctl/crates/flowctl-cli/src/commands/memory.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use super::helpers::get_flow_dir;
1717

1818
// ── Constants ──────────────────────────────────────────────────────
1919

20-
const MEMORY_VALID_TYPES: &[&str] = &["pitfall", "convention", "decision"];
20+
const MEMORY_VALID_TYPES: &[&str] = &["pitfall", "convention", "decision", "general"];
2121

2222
const VALID_SEVERITIES: &[&str] = &["critical", "high", "medium", "low"];
2323

@@ -77,11 +77,11 @@ pub enum MemoryCmd {
7777
Init,
7878
/// Add atomic memory entry.
7979
Add {
80-
/// Type: pitfall, convention, or decision.
81-
#[arg(name = "type")]
82-
entry_type: String,
8380
/// Entry content.
8481
content: String,
82+
/// Type: pitfall, convention, decision, or general.
83+
#[arg(long = "type", default_value = "general", value_parser = ["pitfall", "convention", "decision", "general"])]
84+
entry_type: String,
8585
/// Module scope (e.g. "flowctl-core", "scheduler", "auth").
8686
#[arg(long)]
8787
module: Option<String>,
@@ -509,11 +509,11 @@ fn cmd_memory_add(
509509
None => {
510510
if json {
511511
json_output(json!({
512-
"error": format!("Invalid type '{}'. Use: pitfall, convention, or decision", entry_type)
512+
"error": format!("Invalid type '{}'. Use: pitfall, convention, decision, or general", entry_type)
513513
}));
514514
} else {
515515
eprintln!(
516-
"Error: Invalid type '{}'. Use: pitfall, convention, or decision",
516+
"Error: Invalid type '{}'. Use: pitfall, convention, decision, or general",
517517
entry_type
518518
);
519519
}
@@ -684,11 +684,11 @@ fn cmd_memory_read(json: bool, entry_type: Option<&str>) {
684684
if entry_type.is_some() && type_filter.is_none() {
685685
if json {
686686
json_output(json!({
687-
"error": format!("Invalid type '{}'. Use: pitfall, convention, or decision", entry_type.unwrap())
687+
"error": format!("Invalid type '{}'. Use: pitfall, convention, decision, or general", entry_type.unwrap())
688688
}));
689689
} else {
690690
eprintln!(
691-
"Error: Invalid type '{}'. Use: pitfall, convention, or decision",
691+
"Error: Invalid type '{}'. Use: pitfall, convention, decision, or general",
692692
entry_type.unwrap()
693693
);
694694
}

skills/flow-code-brainstorm/steps/step-02-context-gather.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ FLOWCTL="$HOME/.flow/bin/flowctl"
1717
4. Read key config files, README, CLAUDE.md for project constraints
1818
5. Identify affected modules, dependencies, and integration points
1919
6. Read `.flow/project-context.md` Non-Goals and Architecture Decisions. Do NOT propose approaches that conflict with Non-Goals. Reference Architecture Decisions to avoid re-debating settled choices.
20+
7. Read pitfalls specifically to avoid known failure patterns:
21+
```bash
22+
$FLOWCTL memory list --type pitfall --json
23+
```
2024

2125
## Classify Complexity
2226

skills/flow-code-code-review/SKILL.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,3 +297,10 @@ After completing a review:
297297
- [ ] Change size noted if >500 lines
298298
- [ ] Tests reviewed before implementation
299299
- [ ] No rubber-stamping — every approval reflects genuine review
300+
301+
## Auto-Capture Pitfalls
302+
When verdict is NEEDS_WORK, the orchestrator should capture each Critical/Important finding as a pitfall:
303+
```bash
304+
$FLOWCTL memory add pitfall "Review: <finding summary>"
305+
```
306+
This builds project memory from review failures, preventing the same mistakes in future tasks.

skills/flow-code-run/SKILL.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ Detect input type to decide whether to execute or skip:
146146
- Acceptance Auditor (diff + spec + project-context.md)
147147
5. Merge findings, apply zero-findings rule
148148
6. Fix Critical/Important issues until SHIP (max 2 iterations)
149+
When a review returns NEEDS_WORK, auto-capture the key findings as memory pitfalls:
150+
```bash
151+
$FLOWCTL memory add pitfall "Review finding: <summary of what was wrong and how it was fixed>"
152+
```
149153

150154
### Close (close)
151155
1. Validate: $FLOWCTL validate --epic $EPIC_ID --json

0 commit comments

Comments
 (0)