Skip to content

feat!: replace workflow engine with skills-first kernel - #329

Draft
rochecompaan wants to merge 56 commits into
mainfrom
architecture/skills-first-kernel
Draft

rochecompaan wants to merge 56 commits into
mainfrom
architecture/skills-first-kernel

Conversation

@rochecompaan

Copy link
Copy Markdown
Owner

Summary

  • Replace the deterministic workflow engine with a small skills-first kernel. The kernel owns supervision, issue claims, phase derivation, outcome verification and names. Skills own workflow judgment.
  • Add strict configuration, GitHub and Forgejo adapters, local issue locks, Git/worktree facts, phase selection, process-group cleanup and verified outcomes. Update the CLI, bundled skills, installer, repository setup, packaging and documentation.
  • Retire the old workflow engine and its quality gates. Keep TypeScript checking, ESLint, Prettier, markdownlint and behavioral tests.

Breaking changes

This is a breaking replacement, not an upgrade path. Old configuration, persisted workflow state, commands and labels have no compatibility layer. Use the new configuration and workflow documented in the README.

Size reduction

These counts compare the branch point e422162 with head 437d667. They cover TypeScript in src/ and bin/ and include comments and blank lines. The production count excludes .test.ts files and includes both host adapters.

Scope Before After Reduction
Production TypeScript 53,542 4,300 49,242 lines (92.0%)
TypeScript including tests 138,789 12,044 126,745 lines (91.3%)

Recorded local verification

The saved integration results apply to head 437d667. The committed source matches the validated source hashes. No successful test or integration gate was rerun merely to prepare this PR.

  • npm test: 537 passed, zero failures, cancellations or skips.
  • npm run lint.
  • npm run build.
  • node scripts/smoke-packed-artifact.mjs.
  • npm --prefix site run build: 16 pages built.
  • nix build .#default --no-link.
  • Production size: 4,300 lines. Run envelope: 35 lines. Configuration loader: 164 lines. Bundled skills: 767 lines.
  • Named offline Pi extension-load test passed. This does not prove live model execution.
  • Scoped review accepted the final cleanup correction with no new issues. Regression evidence covers first stdout/stderr destination errors during asynchronous log closure, with and without secondary cleanup failure.

The final source corrections are accepted locally. A minor test-diagnostic cleanup remains deferred. Expected error-path diagnostics, packed-smoke dependency/authentication notices and site i18n/404 warnings remain disclosed, not treated as absent.

Pending acceptance

This PR is a draft because the live acceptance walkthrough remains unperformed. Creating this PR does not authorize the walkthrough or a merge. The following items remain open:

  • Run Task 19's acceptance walkthrough against a disposable repository: setup-test-repo, init, labels setup, triage, run-once to spec-review, approve the spec and requeue, then run-once to agent-done.
  • Record the exact walkthrough commands and resulting test PR URL in this description.
  • Review remote CI and any conflicts with the current main branch.
  • Obtain final feature and merge approval.

Full-flake checks, packaged-Nix runtime extension loading, Bun, other platforms/browser behavior and an exhaustive dependency security audit are not claimed. Default Nix building and offline extension loading prove only their named checks. Local review reports and validation logs remain Git-ignored and are not included in this PR.

Design and plan

Replace the deterministic workflow engine with a five-responsibility kernel: supervise one Pi process, claim and release an issue, derive the phase from git and the host, verify the outcome against the host, and keep stable names. All judgment moves into skills. Workflow state is never persisted.
The kernel assumes a repository that has never run Patchmill. Remove the transition section, the old run-directory rename in init, the removed-key list, the base-branch fallback for spec and plan discovery, and every clause that ports or keeps existing code. Replace them with a no-upgrade-path section and a matching acceptance criterion.
BREAKING CHANGE: the planning state machine, recovery, todo contract, and the run, skills, set-spec, and set-plan commands are gone. A skills-first kernel replaces them in the following commits.
Apply the user-approved limit to the design and implementation plan. Keep the counting method, both host adapters, and all production behavior unchanged.
Restore readable run summaries and progress while keeping agent protocol output in the logs. Keep planning pull requests from closing issues before implementation is complete.
tea has no atomic label swap. Removing first could leave an issue with no workflow label when the addition failed. A failed removal after a successful addition now reports the partial transition.
Title-derived names let a title edit reclassify an existing plan as the spec when both live in one directory. Specs now use YYYY-MM-DD-issue-N-design.md and plans use YYYY-MM-DD-issue-N-plan.md, generated and recognized only in names.ts. The canonicalPlan title exception is gone; hardlink identity checks remain.
A comment failure after completion labeling rewrote the result to stopped/needsInfo while the issue stayed agent-done. Finalization now builds one outcome from the verified label and summary, records label and comment failures as publicationErrors, and attempts the comment even when the label update fails. result.json, console output, and the return value share that outcome. The CLI exits 1 when publication fails.
collectFacts created or repaired the worktree for every caller, so a fresh --dry-run made a local branch and registered worktree before taking the issue lock. Observation now reads artifacts from the existing worktree, or else from the ref provisioning would check out, via the read-only workspaceSource. provisionWorkspace creates the worktree and is called only inside the claimed, locked run loop. Dry runs and post-phase verification only observe.
PullRequest now carries headRepository and baseBranch, and hosts list every same-named head instead of picking one by branch name. The kernel's findPullRequest is the one matcher for selection, gates, verification, and cost publication: the head must be the issue branch in origin's repository, so same-named branches from other forks are ignored while a PR from an origin fork still counts. The base is checked separately with wrongTarget. A PR open against or merged into another branch stops for a person and cannot pass a gate or finish the issue. Head commits are not part of the identity, so new pushes keep the same PR. Forgejo's origin parser moves to host/origin.ts and also accepts SSH host aliases.
Specs use YYYY-MM-DD-issue-N-<slug>-design.md and plans use YYYY-MM-DD-issue-N-<slug>-plan.md, so file names say what they are for. Recognition reads only the issue number and the final -design or -plan suffix, so a title edit cannot swap roles, even when both kinds share a directory. Earlier specs still match; earlier plans need a -plan suffix.
Takes pi-subagents 0.78.0 from #325 with the matching Nix npm hash. Drops the run-admission code from #324, because the kernel's per-issue lock replaces it, and keeps its spec as history. Drops the mockup checks from #323, because they depend on the removed workflow engine, and ports its skill parts: the vendored frontend-design and patchmill-frontend-review skills with their licenses and notices, the frontend design and mockup steps in patchmill-planning, and the frontend review step in patchmill-implementation. The installer, pack metadata, and docs list both new skills. The kernel does not check mockups or their spec links; the planning skill tells the agent to fix them before it finishes.
The kernel's init writes Patchmill paths to .git/info/exclude, so it fails outside a Git repository. The plan requires the smoke fixture to be a repository before it calls init, and the Nix smoke step now runs git init first.
@rochecompaan
rochecompaan force-pushed the architecture/skills-first-kernel branch from 4182611 to c43203e Compare October 26, 2026 10:20

This branch has not been deployed

No deployments
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