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

Commit 8707f35

Browse files
z23ccclaude
andcommitted
feat: V3 MCP-native goal-driven adaptive engine (v0.2.1)
Complete V3 architecture implementation: - New flowctl-mcp crate: rmcp 0.1.5 MCP server with 16 tool handlers (stdio transport) - Domain types: Goal (PlanningMode × SuccessModel orthogonal), Node, PlanVersion, Attempt, Escalation - Storage: 5 goal-scoped stores (GoalStore, PlanStore, AttemptStore, KnowledgeStore, EventStore) - Engine: GoalEngine (assess_goal mode selection), Planner (RiskProfile), Scheduler (DAG), EscalationEngine (3-level) - Knowledge: Learner (record/inject/compound/refresh) with word-overlap scoring + confidence weighting - Quality: PolicyEngine with MCP + Hook adapters for physical enforcement - Provider: ProviderRegistry with ReviewProvider/PlanningProvider traits + NoneProvider - CLI: serve, goal, plan-v3, node, knowledge, policy, session, migrate commands - MCP tools wired: lock→json_store, guard→subprocess, codebase_assess→CodeGraph+NgramIndex - node.finish records Attempt+Event, releases locks, auto-records learning - ADR-011, v3-hooks.json (2 hooks), 3 entry skills, project-context.md updated 469 tests passing. Design doc: docs/v3-final-architecture.md Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c998651 commit 8707f35

43 files changed

Lines changed: 7218 additions & 6 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.flow-config/project-context.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Project Context
2+
3+
> Shared technical standards for all agents. Auto-loaded by workers during re-anchoring.
4+
> Focus on what's **unobvious** — things agents can't infer from code alone.
5+
6+
## Technology Stack
7+
- Language: Rust (edition 2024, MSRV 1.85)
8+
- Runtime: tokio (async, flowctl-mcp crate ONLY)
9+
- MCP SDK: rmcp 0.16 (official Rust MCP SDK)
10+
- DAG: petgraph 0.7
11+
- Search: NgramIndex (bincode), nucleo-matcher (fuzzy)
12+
- Storage: JSON/JSONL files in .flow/ (zero external deps, no SQLite)
13+
- Testing: cargo test + trycmd snapshots
14+
- Linting: cargo clippy (unsafe_code = forbid)
15+
16+
## Guard Commands
17+
```yaml
18+
test: "cd flowctl && cargo test --all"
19+
lint: "cd flowctl && cargo clippy --all -- -D warnings"
20+
typecheck: "cd flowctl && cargo build --all"
21+
format_check: ""
22+
```
23+
24+
## Critical Implementation Rules
25+
- CI: GitHub Actions
26+
- Async boundary: tokio + rmcp are allowed ONLY in `flowctl-mcp` crate. `flowctl-core` MUST remain fully synchronous. MCP crate calls core via `spawn_blocking`.
27+
- Storage: all state is JSON/JSONL files in `.flow/`. No SQLite, no external database.
28+
- Architecture: V3 MCP-native goal-driven engine (see docs/v3-final-architecture.md)
29+
- Pipeline freeze: `pipeline.rs` and `pipeline_phase.rs` are FROZEN — bug fixes only, no new features
30+
31+
## File Conventions
32+
<!-- Maps domains to file patterns for auto domain assignment -->
33+
```yaml
34+
frontend: []
35+
backend: ["flowctl/crates/"]
36+
testing: ["scripts/"]
37+
docs: []
38+
```
39+
40+
## Architecture Decisions
41+
- ADR-011: flowctl is MCP-native runtime (see docs/decisions/ADR-011-v3-mcp-native.md)
42+
- Goal-driven, not pipeline-driven: PlanningMode (Direct/Graph) × SuccessModel (Criteria/Numeric/Mixed)
43+
- 3-crate workspace: flowctl-core (sync domain+storage+engine), flowctl-mcp (async MCP server), flowctl-cli (thin CLI)
44+
- PolicyEngine with 2 adapters (MCP internal + PreToolUse hook) for physical enforcement
45+
- ProviderRegistry with trait abstractions for review/planning backends
46+
47+
## Non-Goals
48+
- Do not add SQLite or any external database dependency
49+
- Do not add async/tokio to flowctl-core (only flowctl-mcp)
50+
- Do not break existing flowctl CLI commands (provide compat shim)
51+
- Do not modify pipeline.rs or pipeline_phase.rs (FROZEN — bug fixes only)
52+
- Do not hardcode RP or Codex logic into core engine (use ProviderRegistry traits)

.mcp.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"mcpServers": {
3+
"forge_extension": {
4+
"url": "http://localhost:13819/mcp"
5+
},
6+
"flowctl": {
7+
"command": "bin/flowctl",
8+
"args": ["serve"]
9+
}
10+
}
11+
}

bin/flowctl

522 KB
Binary file not shown.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# ADR-011: V3 MCP-Native Goal-Driven Architecture
2+
3+
**Status**: Accepted
4+
**Date**: 2026-04-11
5+
**Deciders**: z23cc
6+
**Supersedes**: V1 pipeline state machine
7+
8+
## Context
9+
10+
flowctl has grown to 90+ CLI commands, 52 skills, 24 agents, and 8 hook points. Control logic is scattered across multiple protocol layers. The 6-phase linear pipeline forces all tasks through the same steps regardless of complexity.
11+
12+
## Decision
13+
14+
Transform flowctl from a CLI-only pipeline tool into an MCP-native goal-driven adaptive engine:
15+
16+
1. **MCP Server**: `flowctl serve` starts an rmcp-based MCP server (stdio transport) exposing 16 structured tools
17+
2. **Goal Model**: Replace Epic + 6-phase pipeline with Goal + orthogonal PlanningMode (Direct/Graph) × SuccessModel (Criteria/Numeric/Mixed)
18+
3. **Async Boundary**: tokio + rmcp are confined to `flowctl-mcp` crate. `flowctl-core` remains fully synchronous
19+
4. **3-Crate Architecture**: flowctl-core (domain+storage+engine), flowctl-mcp (MCP server), flowctl-cli (thin CLI facade)
20+
5. **Pipeline Freeze**: `pipeline.rs` and `pipeline_phase.rs` receive bug fixes only, no new features
21+
22+
## Consequences
23+
24+
- flowctl binary grows to include MCP server capability
25+
- First introduction of async runtime (tokio) — strictly confined to flowctl-mcp
26+
- Existing CLI commands preserved via compat shim layer
27+
- Old .flow/ data migrated via `flowctl migrate v3`, originals archived to `.flow/.archive/v1/`
28+
29+
## Alternatives Considered
30+
31+
- **Incremental evolution**: Continue adding to pipeline model. Rejected: complexity ceiling already reached.
32+
- **V3 Draft (merged ExecutionMode)**: Single enum mixing planning and success. Rejected: leads to condition sprawl.
33+
- **5-crate split**: Premature for ~27K LOC codebase. Defer until core exceeds 20K LOC.

0 commit comments

Comments
 (0)