Skip to content

Enforce Teams mode as default parallel execution#2

Merged
z23cc merged 2 commits intomainfrom
fn-5-enforce-teams-mode-as-default-parallel
Apr 3, 2026
Merged

Enforce Teams mode as default parallel execution#2
z23cc merged 2 commits intomainfrom
fn-5-enforce-teams-mode-as-default-parallel

Conversation

@z23cc
Copy link
Copy Markdown
Owner

@z23cc z23cc commented Apr 3, 2026

Summary

Fix the gap where /flow-code:work could skip Teams mode when spawning parallel workers. Three enforcement layers added:

Layer 1 — Prompt hardening (phases.md, SKILL.md)

  • Copyable Teams Setup Checklist in Phase 3c (orchestrator must fill as it executes)
  • Anti-shortcut STOP CHECK block in Phase 3d (explicit gate before spawning)
  • Red Flags table catching common "optimization" thoughts
  • Teams mandate added to SKILL.md Hard requirements

Layer 2 — Runtime enforcement (ralph-guard.py)

  • Edit/Write PreToolUse hook checks file-lock registry when FLOW_TEAMS=1
  • Blocks edits to files locked by another task with clear error
  • Allows edits to own-task files; fails-open on errors

Layer 3 — Worker self-verification (worker.md)

  • Phase 0: Configuration verification (checks OWNED_FILES, FLOW_TASK_ID)
  • Pre-edit self-check gate for OWNED_FILES enforcement
  • Teams-specific items in pre-return checklist
  • Red Flags table for workers

Test plan

  • python3 -m py_compile scripts/hooks/ralph-guard.py passes
  • hooks/hooks.json valid JSON
  • teams_e2e_test.sh — 32/32 passed
  • All changes are backward-compatible (FLOW_TEAMS=1 opt-in)

🤖 Generated with Claude Code

z23cc and others added 2 commits April 3, 2026 12:58
…g table

- Add Phase 0: verify OWNED_FILES, TASK_ID, and log ownership set
- Add TEAM_MODE Pre-Edit Gate in Phase 2 with explicit stop-and-check
- Strengthen pre-return checklist with Teams-specific items
- Add Red Flag Thoughts table to catch common bypass patterns

Task: fn-5-enforce-teams-mode-as-default-parallel.3
When FLOW_TEAMS=1, the PreToolUse hook now checks the flowctl file-lock
registry before allowing Edit/Write operations. Edits to files locked by
another task are blocked; edits to own-task files are allowed. Fails-open
on errors for graceful degradation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@z23cc z23cc merged commit efdc620 into main Apr 3, 2026
z23cc added a commit that referenced this pull request Apr 5, 2026
Adds a lightweight per-task narrative dump at `.flow/outputs/<task-id>.md`
that workers write in new Phase 5c and the next worker auto-reads during
Phase 1 re-anchor. Gated on a new `outputs.enabled` config key (default
true), fully independent from `memory.enabled` — outputs is a narrative
handoff layer, not part of the verified memory system.

- flowctl-core: new `OutputEntry` protocol type (convention #8)
- flowctl-service: new `OutputsStore` (file-system native, no libSQL)
- flowctl-cli: new `flowctl outputs write|list|show` commands
- Phase 5c `outputs_dump` added to worker sequence dynamically based on
  `outputs.enabled` config; worker.md Phase 1 extended to list+show prior
  outputs (limit 3) and Phase 5c added between Phase 5 and Phase 5b
- `done_task()` in lifecycle.rs intentionally unchanged — worker owns the
  dump explicitly in Phase 5c, keeping runtime agnostic of narrative shape
- Missing `## Surprises`/`## Decisions` sections allowed (pitfall #2)
z23cc added a commit that referenced this pull request Apr 9, 2026
P0 fixes (state loss — root cause of 5 issues):
- get_flow_dir() now walks up directory tree (FLOW_STATE_DIR env → walk-up → CWD)
  Fixes: #1 state loss, #3 state not persistent, #5 worker parallel fail,
  #9 .flow symlink issues. Same pattern as git finding .git.
- flowctl recover --epic <id> [--dry-run]: rebuilds task completion status
  from git log. Fixes #11 no recovery after state loss.

P1 fixes (guard + review):
- Guard graceful fallback: missing tools → "skipped" (not "failed").
  Only actual failures block pipeline. Fixes #8.
- Review-backend availability check: if rp-cli/codex not in PATH,
  auto-fallback to "none" with warning. Fixes #7.

P2 fixes (UX):
- Slug max length 40→20 chars. "Django+React platform with account
  management" → "fn-3-django-react-plat" not 40-char monster. Fixes #2 #12.
- Brainstorm auto-skip: trivial tasks (≤10 words, contains "fix"/"typo"/etc)
  skip brainstorm entirely. Fixes #6.
- --interactive flag: pause at key decisions. Fixes #10.

370 tests pass. Zero new dependencies.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant