Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
0675a36
chore: initialize spec 081-executor-docs-tests
mrmaxsteel Mar 10, 2026
41f3215
chore: approve spec 081-executor-docs-tests
mrmaxsteel Mar 10, 2026
2b41c76
chore: approve plan for 081-executor-docs-tests
mrmaxsteel Mar 10, 2026
cdfe4a4
refactor: rename GitExecutor to MindspecExecutor, purge gitops from l…
mrmaxsteel Mar 10, 2026
fb56e08
spec: add Bead 5 — harden phase-transition stop behavior
mrmaxsteel Mar 10, 2026
9c4434c
plan: Bead 4 creates stop-behavior tests, Bead 5 depends on 4
mrmaxsteel Mar 10, 2026
ca3ff1d
impl(mindspec-4ya5.2): Rename internal/specinit/ to internal/spec/ wi…
mrmaxsteel Mar 10, 2026
bcf2c07
Merge bead/mindspec-4ya5.2
mrmaxsteel Mar 10, 2026
08e7340
fix: resolve spec from bead ID and always force-remove worktrees
mrmaxsteel Mar 10, 2026
2f1ffbe
fix: verify bead branch is merged before force-removing worktree
mrmaxsteel Mar 10, 2026
7100a0d
impl(mindspec-4ya5.3): Architecture documentation overhaul: rewrite A…
mrmaxsteel Mar 10, 2026
8af5438
Merge bead/mindspec-4ya5.3
mrmaxsteel Mar 10, 2026
dfc923e
docs: rewrite README with two-layer architecture framing
mrmaxsteel Mar 10, 2026
c2382e8
docs: emphasize beads as substrate between planning and execution layers
mrmaxsteel Mar 10, 2026
2ed17da
docs: simplify architecture heading in README
mrmaxsteel Mar 10, 2026
b64aab3
docs: minor wording tweak in README execution engine section
mrmaxsteel Mar 10, 2026
4778beb
docs: reframe orchestrator pluggability as MindSpec plugging into them
mrmaxsteel Mar 10, 2026
168cb08
impl(mindspec-4ya5.4): Audit all 18 LLM test scenarios — document fin…
mrmaxsteel Mar 10, 2026
28f91e3
Merge bead/mindspec-4ya5.4
mrmaxsteel Mar 10, 2026
7566b52
audit: flag SpecToIdle STOP instruction tension in test audit
mrmaxsteel Mar 10, 2026
d6276ab
impl(mindspec-qszb): Add stop-behavior LLM tests (StopAfterComplete, …
mrmaxsteel Mar 10, 2026
6404f1b
Merge bead/mindspec-qszb
mrmaxsteel Mar 10, 2026
b4f4916
style: fix gofmt alignment in complete.go var block
mrmaxsteel Mar 11, 2026
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
24 changes: 13 additions & 11 deletions .mindspec/docs/domains/execution/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,29 @@
The `Executor` interface separates enforcement ("what") from execution ("how"):

```
Workflow Layer Execution Layer
┌─────────────────┐ ┌──────────────────┐
│ approve/ │──Executor──▶│ executor/git.go
│ complete/ │ interface │ (GitExecutor)
│ next/ │ │ │
specinit/ │ │ gitutil/ │
│ cleanup/ │ │ (low-level ops) │
└─────────────────┘ └──────────────────┘
Workflow Layer Execution Engine
┌─────────────────┐ ┌─────────────────────────────
│ approve/ │──Executor──▶│ executor/mindspec_executor.go│
│ complete/ │ interface │ (MindspecExecutor)
│ next/ │ │
spec/ │ │ gitutil/
│ cleanup/ │ │ (low-level ops)
└─────────────────┘ └─────────────────────────────
```

- **GitExecutor** — concrete implementation wrapping git+worktree operations
- **MindspecExecutor** — concrete implementation wrapping git+worktree operations (dispatches beads to worktrees, merges completed bead branches, finalizes specs)
- **MockExecutor** — test double for enforcement testing without git side effects
- **DI wiring** — `cmd/mindspec/root.go` has `newExecutor(root)` factory

The execution engine reads beads produced by the planning layer. Each bead is a self-contained work packet — requirements, context, dependencies, acceptance criteria — so a fresh agent can pick it up without session history. Beads are the substrate that makes the `Executor` interface pluggable: any orchestrator that can read a bead can dispatch work.

### withWorkingDir Safety

Worktree removal and branch deletion require CWD to be outside the target worktree. `GitExecutor` uses `withWorkingDir(root, func)` to temporarily chdir to the repo root before destructive operations, then restores the original CWD. This prevents "cannot remove worktree: in use" errors.
Worktree removal and branch deletion require CWD to be outside the target worktree. `MindspecExecutor` uses `withWorkingDir(root, func)` to temporarily chdir to the repo root before destructive operations, then restores the original CWD. This prevents "cannot remove worktree: in use" errors.

### Function Injection for Testability

`GitExecutor` exposes function variables (`WorktreeRemoveFn`, `DeleteBranchFn`, `MergeBranchFn`, etc.) that can be replaced in tests. This avoids requiring a real git repository for unit tests while keeping the production code straightforward.
`MindspecExecutor` exposes function variables (`WorktreeRemoveFn`, `DeleteBranchFn`, `MergeBranchFn`, etc.) that can be replaced in tests. This avoids requiring a real git repository for unit tests while keeping the production code straightforward.

### Branch Conventions

Expand Down
6 changes: 3 additions & 3 deletions .mindspec/docs/domains/execution/interfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type Executor interface {
FinalizeEpic(epicID, specID, specBranch string) (FinalizeResult, error)
Cleanup(specID string, force bool) error

// Epic handoff (notification hook — no-op for GitExecutor)
// Epic handoff (notification hook — no-op for MindspecExecutor)
HandoffEpic(epicID, specID string, beadIDs []string) error

// Query methods
Expand All @@ -26,7 +26,7 @@ type Executor interface {

### GitUtil Helpers (`internal/gitutil/gitutil.go`)

Low-level git operations used only by `GitExecutor`:
Low-level git operations used only by `MindspecExecutor`:

| Function | Purpose |
|:---------|:--------|
Expand All @@ -49,5 +49,5 @@ Low-level git operations used only by `GitExecutor`:

| Type | Package | Purpose |
|:-----|:--------|:--------|
| `GitExecutor` | `internal/executor/git.go` | Production: real git+worktree operations |
| `MindspecExecutor` | `internal/executor/mindspec_executor.go` | Production: real git+worktree operations |
| `MockExecutor` | `internal/executor/mock.go` | Testing: records calls, returns configured errors |
9 changes: 5 additions & 4 deletions .mindspec/docs/domains/execution/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## What This Domain Owns

The **execution** domain owns all git, worktree, and filesystem operations — the "how" layer that performs operations delegated by the workflow layer.
The **execution engine** owns all git, worktree, and filesystem operations — the "how" layer that implements operations delegated by the workflow layer. It dispatches beads to worktrees, executes code changes, merges results, and finalizes specs.

- **Git operations** — branching, merging, diffstat, commit counting, push/PR creation
- **Worktree lifecycle** — creating, removing, and switching between isolated workspaces
Expand All @@ -14,6 +14,7 @@ The **execution** domain owns all git, worktree, and filesystem operations — t
Execution does **not** own:
- Lifecycle phase derivation or mode enforcement (workflow)
- Approval gates or validation logic (workflow)
- Plan decomposition or quality assessment (workflow)
- Beads integration or epic/bead queries (workflow)
- CLI infrastructure or project health checks (core)

Expand All @@ -23,9 +24,9 @@ Execution **receives** instructions from the workflow layer via the `Executor` i

| Package | Purpose |
|:--------|:--------|
| `internal/executor/` | `Executor` interface + `GitExecutor` + `MockExecutor` |
| `internal/gitutil/` | Low-level git helpers (branch, merge, PR, diffstat) |
| `internal/executor/` | `Executor` interface + `MindspecExecutor` (production) + `MockExecutor` (testing) |
| `internal/gitutil/` | Low-level git helpers (branch, merge, PR, diffstat) — used only by `MindspecExecutor` |

## Import Rule

Workflow packages (`internal/approve/`, `internal/complete/`, `internal/next/`, `internal/cleanup/`, `internal/specinit/`) MUST call `executor.Executor` methods. They MUST NOT import `internal/gitutil/` directly. This boundary is enforced by convention and checked by `mindspec doctor`.
Workflow packages (`internal/approve/`, `internal/complete/`, `internal/next/`, `internal/cleanup/`, `internal/spec/`) MUST call `executor.Executor` methods. They MUST NOT import `internal/gitutil/` directly. This boundary is enforced by convention and checked by `mindspec doctor`.
20 changes: 18 additions & 2 deletions .mindspec/docs/domains/workflow/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ Each mode gates:
- **Required context** — what must be reviewed before proceeding
- **Transition gates** — what conditions must hold to advance

### Beads as Single State Store (ADR-0023)
### Beads as Substrate (ADR-0023)

Beads is both the single state store and the **contract between the planning and execution layers**. Each bead is a self-contained work packet that encapsulates requirements, context (impacted domains, ADR citations), dependencies, and acceptance criteria. A fresh agent picking up a bead doesn't need session history — the bead carries everything it needs.

This is what makes execution pluggable: any orchestrator that can read beads can dispatch work. The planning layer writes beads; the execution engine reads them.

All lifecycle state is derived from Beads — no filesystem state files (no `focus`, no `lifecycle.yaml`):

Expand Down Expand Up @@ -46,7 +50,19 @@ approve/impl.go ──▶ exec.FinalizeEpic()
cleanup/ ──▶ exec.Cleanup()
```

**Import rule**: Workflow packages (`approve/`, `complete/`, `next/`, `cleanup/`, `specinit/`) call `executor.Executor` methods. They MUST NOT import `internal/gitutil/` directly.
**Import rule**: Workflow packages (`approve/`, `complete/`, `next/`, `cleanup/`, `spec/`) call `executor.Executor` methods. They MUST NOT import `internal/gitutil/` directly.

### Plan Quality Responsibility

The workflow layer ensures plans are well-decomposed before handoff to the execution engine. This is critical because AI agents perform significantly better on well-structured, bitesize tasks than on vague or monolithic ones (see [arXiv:2512.08296](https://arxiv.org/abs/2512.08296)).

Workflow enforces:
- **Bead decomposition** — each bead must be a focused, independently completable unit of work
- **Clear acceptance criteria** — every bead has verifiable completion conditions
- **Dependency ordering** — beads declare dependencies so the execution engine dispatches them in the right order
- **Validation gates** — `internal/validate/` checks structural requirements and ADR compliance before plan approval

The execution engine trusts that approved plans are well-decomposed and simply executes them — it does not assess plan quality.

### ADR Governance

Expand Down
2 changes: 1 addition & 1 deletion .mindspec/docs/domains/workflow/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Workflow **uses** context packs (from context-system) to provide mode-appropriat
| `internal/approve/` | Spec, plan, and impl approval enforcement |
| `internal/complete/` | Bead close-out orchestration |
| `internal/next/` | Work selection, claiming, worktree dispatch |
| `internal/specinit/` | Spec creation (worktree-first flow) |
| `internal/spec/` | Spec creation (worktree-first flow) |
| `internal/cleanup/` | Post-lifecycle worktree/branch cleanup |
| `internal/phase/` | Phase derivation from beads (ADR-0023) |
| `internal/resolve/` | Target spec resolution and prefix matching |
Expand Down
Loading