Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Commands with Teams Variant ship as `{name}.md` (parallel subagents) and `{name}

**Working Memory**: Three shell-script hooks (`scripts/hooks/`) provide automatic session continuity. Toggleable via `devflow memory --enable/--disable/--status` or `devflow init --memory/--no-memory`. Stop hook → reads last turn from session transcript (`~/.claude/projects/{encoded-cwd}/{session_id}.jsonl`), spawns background `claude -p --model haiku` to update `.memory/WORKING-MEMORY.md` with structured sections (`## Now`, `## Progress`, `## Decisions`, `## Modified Files`, `## Context`, `## Session Log`; throttled: skips if triggered <2min ago; concurrent sessions serialize via mkdir-based lock). SessionStart hook → injects previous memory + git state as `additionalContext` on `/clear`, startup, or compact (warns if >1h stale; injects pre-compact memory snapshot when compaction happened mid-session). PreCompact hook → saves git state + WORKING-MEMORY.md snapshot + bootstraps minimal WORKING-MEMORY.md if none exists. Zero-ceremony context preservation.

**Ambient Mode**: Three-layer architecture for always-on intent classification. SessionStart hook (`session-start-classification`) reads lean classification rules (`~/.claude/skills/devflow:router/references/classification-rules.md`, ~30 lines) and injects as `additionalContext` — once per session, deterministic, zero model overhead. UserPromptSubmit hook (`preamble`) injects a one-sentence prompt per message triggering classification + router loading via Skill tool. Router SKILL.md is a pure skill lookup table (~50 lines) loaded on-demand only for GUIDED/ORCHESTRATED depth — maps intent×depth to domain and orchestration skills. Toggleable via `devflow ambient --enable/--disable/--status` or `devflow init`.

**Self-Learning**: A SessionEnd hook (`session-end-learning`) accumulates session IDs and triggers a background `claude -p --model sonnet` every 3 sessions (5 at 15+ observations) to detect repeated workflows and procedural knowledge from batch transcripts. Observations accumulate in `.memory/learning-log.jsonl` with confidence scores, temporal decay, and daily run caps. When confidence thresholds are met (5 observations with 7-day temporal spread for both workflow and procedural types), artifacts are auto-created as slash commands (`.claude/commands/self-learning/`) or skills (`.claude/skills/{slug}/`). Loaded artifacts are reinforced locally (no LLM) on each session end. Single toggle mechanism: hook presence in `settings.json` IS the enabled state — no `enabled` field in `learning.json`. Toggleable via `devflow learn --enable/--disable/--status` or `devflow init --learn/--no-learn`. Configurable model/throttle/caps/debug via `devflow learn --configure`. Use `devflow learn --reset` to remove all artifacts + log + transient state. Use `devflow learn --purge` to remove invalid observations. Debug logs stored at `~/.devflow/logs/{project-slug}/`.

**Claude Code Flags**: Typed registry (`src/cli/utils/flags.ts`) for managing Claude Code feature flags (env vars and top-level settings). Pure functions `applyFlags`/`stripFlags`/`getDefaultFlags` follow the `applyTeamsConfig`/`stripTeamsConfig` pattern. Initial flags: `tool-search`, `lsp`, `clear-context-on-plan` (default ON), `brief`, `disable-1m-context` (default OFF). Manageable via `devflow flags --enable/--disable/--status/--list`. Stored in manifest `features.flags: string[]`.
Expand All @@ -55,7 +57,7 @@ devflow/
├── plugins/devflow-*/ # 17 plugins (8 core + 9 optional language/ecosystem)
├── docs/reference/ # Detailed reference documentation
├── scripts/ # Helper scripts (statusline, docs-helpers)
│ └── hooks/ # Working Memory + ambient + learning hooks (stop, session-start, pre-compact, preamble, session-end-learning, stop-update-learning [deprecated], background-learning)
│ └── hooks/ # Working Memory + ambient + learning hooks (stop, session-start-memory, session-start-classification, pre-compact, preamble, session-end-learning, stop-update-learning [deprecated], background-learning)
├── src/cli/ # TypeScript CLI (init, list, uninstall, ambient, learn, flags)
├── .claude-plugin/ # Marketplace registry
├── .docs/ # Project docs (reviews, design) — per-project
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions plugins/devflow-ambient/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# devflow-ambient

Ambient mode — classifies intent and applies proportional effort via a `UserPromptSubmit` hook. No slash command — ambient mode activates automatically on every prompt when enabled.
Ambient mode — classifies intent and applies proportional effort via a `SessionStart` hook and a `UserPromptSubmit` hook. No slash command — ambient mode activates automatically on every prompt when enabled.

## Activation

```bash
devflow ambient --enable # Register UserPromptSubmit hook
devflow ambient --enable # Register ambient mode hooks
devflow ambient --disable # Remove hook
devflow ambient --status # Check if enabled
```
Expand Down Expand Up @@ -44,9 +44,9 @@ Skills are loaded via the Skill tool and work happens in the main session:

| Intent | Skills | Main Session Work | Post-Work |
|--------|--------|-------------------|-----------|
| IMPLEMENT | test-driven-development, patterns, research | Implement with TDD | `Task(subagent_type="Simplifier")` |
| DEBUG | software-design, testing | Investigate, diagnose, fix | `Task(subagent_type="Simplifier")` |
| PLAN | patterns, software-design | Explore and design | — |
| IMPLEMENT | test-driven-development, patterns, research | Implement with TDD | `Agent(subagent_type="Simplifier")` |
| DEBUG | test-driven-development, software-design, testing | Investigate, diagnose, fix | `Agent(subagent_type="Simplifier")` |
| PLAN | test-driven-development, patterns, software-design, security | Explore and design | — |
| REVIEW | quality-gates, software-design | Review directly | — |

## ORCHESTRATED Pipelines
Expand Down
4 changes: 2 additions & 2 deletions plugins/devflow-code-review/commands/code-review-teams.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Run a comprehensive code review of the current branch by spawning a review team
For each reviewable worktree, spawn Git agent:

```
Task(subagent_type="Git", run_in_background=false):
Agent(subagent_type="Git", run_in_background=false):
"OPERATION: ensure-pr-ready
WORKTREE_PATH: {worktree_path} (omit if cwd)
Validate branch, commit if needed, push, create PR if needed.
Expand Down Expand Up @@ -218,7 +218,7 @@ Spawn 2 agents **in a single message**:

**Git Agent (PR Comments)**:
```
Task(subagent_type="Git", run_in_background=false):
Agent(subagent_type="Git", run_in_background=false):
"OPERATION: comment-pr
WORKTREE_PATH: {worktree_path} (omit if cwd)
Read reviews from {worktree_path}/.docs/reviews/{branch_slug}/{timestamp}/
Expand Down
8 changes: 4 additions & 4 deletions plugins/devflow-code-review/commands/code-review.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Run a comprehensive code review of the current branch by spawning parallel revie
For each reviewable worktree, spawn Git agent:

```
Task(subagent_type="Git", run_in_background=false):
Agent(subagent_type="Git", run_in_background=false):
"OPERATION: ensure-pr-ready
WORKTREE_PATH: {worktree_path} (omit if cwd)
Validate branch, commit if needed, push, create PR if needed.
Expand Down Expand Up @@ -109,7 +109,7 @@ Spawn Reviewer agents **in a single message**. Always run 7 core reviews; condit

Each Reviewer invocation (all in one message, **NOT background**):
```
Task(subagent_type="Reviewer", run_in_background=false):
Agent(subagent_type="Reviewer", run_in_background=false):
"Review focusing on {focus}. Load the pattern skill for your focus from the Focus Areas table.
Follow 6-step process from devflow:review-methodology.
PR: #{pr_number}, Base: {base_branch}
Expand All @@ -126,7 +126,7 @@ In multi-worktree mode, process worktrees **sequentially** (one worktree at a ti

**Git Agent (PR Comments)** per worktree:
```
Task(subagent_type="Git", run_in_background=false):
Agent(subagent_type="Git", run_in_background=false):
"OPERATION: comment-pr
WORKTREE_PATH: {worktree_path} (omit if cwd)
Read reviews from {worktree_path}/.docs/reviews/{branch-slug}/{timestamp}/
Expand All @@ -139,7 +139,7 @@ Check for existing inline comments at same file:line before creating new ones to

**Synthesizer Agent** per worktree:
```
Task(subagent_type="Synthesizer", run_in_background=false):
Agent(subagent_type="Synthesizer", run_in_background=false):
"Mode: review
WORKTREE_PATH: {worktree_path} (omit if cwd)
REVIEW_BASE_DIR: {worktree_path}/.docs/reviews/{branch-slug}/{timestamp}
Expand Down
2 changes: 1 addition & 1 deletion plugins/devflow-debug/commands/debug-teams.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Read `.memory/knowledge/decisions.md` and `.memory/knowledge/pitfalls.md`. Known
If `$ARGUMENTS` starts with `#`, fetch the GitHub issue:

```
Task(subagent_type="Git"):
Agent(subagent_type="Git"):
"OPERATION: fetch-issue
ISSUE: {issue number}
Return issue title, body, labels, and any linked error logs."
Expand Down
10 changes: 5 additions & 5 deletions plugins/devflow-debug/commands/debug.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Read `.memory/knowledge/decisions.md` and `.memory/knowledge/pitfalls.md`. Known
If `$ARGUMENTS` starts with `#`, fetch the GitHub issue:

```
Task(subagent_type="Git"):
Agent(subagent_type="Git"):
"OPERATION: fetch-issue
ISSUE: {issue number}
Return issue title, body, labels, and any linked error logs."
Expand All @@ -48,7 +48,7 @@ Analyze the bug description (from arguments or issue) and identify 3-5 plausible
Spawn one Explore agent per hypothesis in a **single message** (parallel execution):

```
Task(subagent_type="Explore"):
Agent(subagent_type="Explore"):
"Investigate this bug: {bug_description}

Hypothesis: {hypothesis A description}
Expand All @@ -67,15 +67,15 @@ Return a structured report:
- Evidence AGAINST: [list with file:line refs]
- Key finding: {one-sentence summary}"

Task(subagent_type="Explore"):
Agent(subagent_type="Explore"):
"Investigate this bug: {bug_description}

Hypothesis: {hypothesis B description}
Focus area: {specific code area, mechanism, or condition}

[same steps and return format]"

Task(subagent_type="Explore"):
Agent(subagent_type="Explore"):
"Investigate this bug: {bug_description}

Hypothesis: {hypothesis C description}
Expand All @@ -91,7 +91,7 @@ Focus area: {specific code area, mechanism, or condition}
Once all investigators return, spawn a Synthesizer agent to aggregate findings:

```
Task(subagent_type="Synthesizer"):
Agent(subagent_type="Synthesizer"):
"You are a root cause analyst. Synthesize these investigation reports:

{paste all investigator reports}
Expand Down
40 changes: 20 additions & 20 deletions plugins/devflow-implement/commands/implement-teams.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Record the current branch name as `BASE_BRANCH` - this will be the PR target.
Spawn Git agent to set up task environment. The Git agent derives the branch name automatically from the issue or task description:

```
Task(subagent_type="Git"):
Agent(subagent_type="Git"):
"OPERATION: setup-task
BASE_BRANCH: {current branch name}
ISSUE_INPUT: {issue number if $ARGUMENTS starts with #, otherwise omit}
Expand All @@ -51,7 +51,7 @@ Return the branch setup summary."
Spawn Skimmer agent for codebase overview:

```
Task(subagent_type="Skimmer"):
Agent(subagent_type="Skimmer"):
"Orient in codebase for: {task description}
Run rskim on source directories (NOT repo root) to identify relevant files, functions, integration points"
```
Expand Down Expand Up @@ -156,7 +156,7 @@ Step 3: GATE — Verify TeamDelete succeeded
You MUST spawn the Synthesizer agent.

```
Task(subagent_type="Synthesizer"):
Agent(subagent_type="Synthesizer"):
"Synthesize EXPLORATION outputs for: {task}
Mode: exploration
Explorer consensus: {team exploration consensus output}
Expand Down Expand Up @@ -252,7 +252,7 @@ Step 3: GATE — Verify TeamDelete succeeded
You MUST spawn the Synthesizer agent.

```
Task(subagent_type="Synthesizer"):
Agent(subagent_type="Synthesizer"):
"Synthesize PLANNING outputs for: {task}
Mode: planning
Planner consensus: {team planning consensus output}
Expand Down Expand Up @@ -282,7 +282,7 @@ Based on Phase 6 synthesis, use the three-strategy framework:
**SINGLE_CODER** (default):

```
Task(subagent_type="Coder"):
Agent(subagent_type="Coder"):
"TASK_ID: {task-id}
TASK_DESCRIPTION: {description}
BASE_BRANCH: {base branch}
Expand All @@ -300,7 +300,7 @@ Spawn Coders one at a time, passing handoff summaries between phases:

**Phase 1 Coder:**
```
Task(subagent_type="Coder"):
Agent(subagent_type="Coder"):
"TASK_ID: {task-id}
TASK_DESCRIPTION: {phase 1 description}
BASE_BRANCH: {base branch}
Expand All @@ -313,7 +313,7 @@ HANDOFF_REQUIRED: true"

**Phase 2+ Coders** (after prior phase completes):
```
Task(subagent_type="Coder"):
Agent(subagent_type="Coder"):
"TASK_ID: {task-id}
TASK_DESCRIPTION: {phase N description}
BASE_BRANCH: {base branch}
Expand All @@ -335,7 +335,7 @@ HANDOFF_REQUIRED: {true if not last phase}"
Spawn multiple Coders **in a single message**, each with independent subtask:

```
Task(subagent_type="Coder"): # Coder 1
Agent(subagent_type="Coder"): # Coder 1
"TASK_ID: {task-id}-part1
TASK_DESCRIPTION: {independent subtask 1}
BASE_BRANCH: {base branch}
Expand All @@ -344,7 +344,7 @@ PATTERNS: {patterns}
CREATE_PR: false
DOMAIN: {subtask 1 domain}"

Task(subagent_type="Coder"): # Coder 2 (same message)
Agent(subagent_type="Coder"): # Coder 2 (same message)
"TASK_ID: {task-id}-part2
TASK_DESCRIPTION: {independent subtask 2}
BASE_BRANCH: {base branch}
Expand All @@ -365,7 +365,7 @@ DOMAIN: {subtask 2 domain}"
After Coder completes, spawn Validator to verify correctness:

```
Task(subagent_type="Validator", model="haiku"):
Agent(subagent_type="Validator", model="haiku"):
"FILES_CHANGED: {list of files from Coder output}
VALIDATION_SCOPE: full
Run build, typecheck, lint, test. Report pass/fail with failure details."
Expand All @@ -377,7 +377,7 @@ Run build, typecheck, lint, test. Report pass/fail with failure details."
3. If `validation_retry_count <= 2`:
- Spawn Coder with fix context:
```
Task(subagent_type="Coder"):
Agent(subagent_type="Coder"):
"TASK_ID: {task-id}
TASK_DESCRIPTION: Fix validation failures
OPERATION: validation-fix
Expand All @@ -395,7 +395,7 @@ Run build, typecheck, lint, test. Report pass/fail with failure details."
After validation passes, spawn Simplifier to polish the code:

```
Task(subagent_type="Simplifier"):
Agent(subagent_type="Simplifier"):
"Simplify recently implemented code
Task: {task description}
FILES_CHANGED: {list of files from Coder output}
Expand All @@ -407,7 +407,7 @@ Focus on code modified by Coder, apply project standards, enhance clarity"
After Simplifier completes, spawn Scrutinizer as final quality gate:

```
Task(subagent_type="Scrutinizer"):
Agent(subagent_type="Scrutinizer"):
"TASK_DESCRIPTION: {task description}
FILES_CHANGED: {list of files from Coder output}
Evaluate 9 pillars, fix P0/P1 issues, report status"
Expand All @@ -420,7 +420,7 @@ If Scrutinizer returns BLOCKED, report to user and halt.
If Scrutinizer made code changes (status: FIXED), spawn Validator to verify:

```
Task(subagent_type="Validator", model="haiku"):
Agent(subagent_type="Validator", model="haiku"):
"FILES_CHANGED: {files modified by Scrutinizer}
VALIDATION_SCOPE: changed-only
Verify Scrutinizer's fixes didn't break anything."
Expand Down Expand Up @@ -503,7 +503,7 @@ Step 3: GATE — Verify TeamDelete succeeded
3. If `alignment_fix_count <= 2`:
- Spawn Coder to fix misalignments:
```
Task(subagent_type="Coder"):
Agent(subagent_type="Coder"):
"TASK_ID: {task-id}
TASK_DESCRIPTION: Fix alignment issues
OPERATION: alignment-fix
Expand All @@ -513,7 +513,7 @@ Step 3: GATE — Verify TeamDelete succeeded
```
- Spawn Validator to verify fix didn't break tests:
```
Task(subagent_type="Validator", model="haiku"):
Agent(subagent_type="Validator", model="haiku"):
"FILES_CHANGED: {files modified by fix Coder}
VALIDATION_SCOPE: changed-only"
```
Expand All @@ -526,7 +526,7 @@ Step 3: GATE — Verify TeamDelete succeeded
After Evaluator passes, spawn Tester for scenario-based acceptance testing (standalone agent, not a teammate — testing is sequential, not debate):

```
Task(subagent_type="Tester"):
Agent(subagent_type="Tester"):
"ORIGINAL_REQUEST: {task description or issue content}
EXECUTION_PLAN: {synthesized plan from Phase 6}
FILES_CHANGED: {list of files from Coder output}
Expand All @@ -542,7 +542,7 @@ Design and execute scenario-based acceptance tests. Report PASS or FAIL with evi
3. If `qa_retry_count <= 2`:
- Spawn Coder to fix QA failures:
```
Task(subagent_type="Coder"):
Agent(subagent_type="Coder"):
"TASK_ID: {task-id}
TASK_DESCRIPTION: Fix QA test failures
OPERATION: qa-fix
Expand All @@ -552,7 +552,7 @@ Design and execute scenario-based acceptance tests. Report PASS or FAIL with evi
```
- Spawn Validator to verify fix didn't break tests:
```
Task(subagent_type="Validator", model="haiku"):
Agent(subagent_type="Validator", model="haiku"):
"FILES_CHANGED: {files modified by fix Coder}
VALIDATION_SCOPE: changed-only"
```
Expand Down Expand Up @@ -652,7 +652,7 @@ If the Coder's report includes Key Decisions with architectural significance:
6. **Clean handoffs** - Each phase passes structured data to next; sequential Coders pass implementation summaries
7. **Honest reporting** - Display agent outputs directly
8. **Simplification pass** - Code refined for clarity before PR
9. **Strict delegation** - Never perform agent work in main session. "Spawn X" means call Task tool with X, not do X's work yourself
9. **Strict delegation** - Never perform agent work in main session. "Spawn X" means call Agent tool with X, not do X's work yourself
10. **Validator owns validation** - Never run `npm test`, `npm run build`, or similar in main session; always delegate to Validator agent
11. **Coder owns fixes** - Never implement fixes in main session; spawn Coder for validation failures and alignment fixes
12. **Loop limits** - Max 2 validation retries, max 2 alignment fix iterations before escalating to user
Expand Down
Loading
Loading