sf snapshot: pre-dispatch, uncommitted changes after 31m inactivity

This commit is contained in:
Mikael Hugo 2026-05-10 06:26:32 +02:00
parent 074dab5644
commit 20c0d74106
11 changed files with 149 additions and 6 deletions

10
.sf/DECISIONS.md Normal file
View file

@ -0,0 +1,10 @@
# Decisions Register
<!-- Append-only. Never edit or remove existing rows.
To reverse a decision, add a new row that supersedes it.
Read this file at the start of any planning or research phase. -->
| # | When | Scope | Decision | Choice | Rationale | Revisable? | Made By |
|---|---|------|----------|--------|-----------|------------|--------|
| D001 | M001-3hf5k0/S01 | architecture | Recover from the most recent valid backup rather than attempting raw SQLite page repair | Copy `.sf/backups/db/sf.db.2026-05-10T02-42-23-822Z` to `.sf/sf.db`, clear WAL/SHM files | The WAL file is 0 bytes (empty), meaning all committed transactions are in the main DB file. The corruption is in the main DB pages, not the WAL. The backup at 02:42 is ~3 hours old and contains the full planning state (M001-6377a4 with 5 slices, M002-f6fabd). Recovery from backup is faster and more reliable than page-level repair. | Yes — if a newer backup becomes available or if the page-repair approach proves more complete | agent |
| D002 | M001-3hf5k0/S01 | pattern | Keep the M001-3hf5k0 directory created by the autonomous bootstrap session as the working directory for this recovery milestone | Use M001-3hf5k0/ for M001-3hf5k0 milestone files; use M001-6377a4/ for recovered milestone files | The autonomous session created the M001-3hf5k0 directory structure at 05:56. Using it avoids creating duplicate directory entries. After DB recovery, M001-6377a4 becomes the active milestone from the DB and its roadmap files can be created in M001-6377a4/. The DB is authoritative for milestone identity. | Yes — if the M001-6377a4/ directory creation conflicts with other tooling | agent |

40
.sf/PROJECT.md Normal file
View file

@ -0,0 +1,40 @@
---
generated: 2026-05-10T03:56:00Z
sf_version: 2.75.3
---
# SF — Singularity Forge
**What it does:** Autonomous repo operator built on Pi SDK. Takes bounded intent, applies PDD/TDD gates, executes milestones/slices/tasks with self-healing recovery, and produces verified software.
**Core value:** Purpose-to-software compiler — not a generic coding assistant. Every unit must name its purpose, consumer, and falsifiable contract before implementation.
**Current state:** BLOCKED. SQLite DB (`.sf/sf.db`) is malformed (corrupted). DB backup exists at `.sf/backups/db/sf.db.2026-05-10T02-42-23-822Z`. This milestone recovers the DB and executes the highest-value pending task from the recovered roadmap.
**Architecture:** TypeScript monorepo (7 workspace packages), Rust N-API engine, Next.js web frontend, Pi SDK harness. Extension source at `src/resources/extensions/sf/` compiled to `dist/resources/extensions/sf/`.
## Milestone Sequence
- [ ] **M001-3hf5k0**: DB Recovery and S01-T01 Execution — recover corrupted DB, execute CLI/help doctrine fix
- [ ] **M001-6377a4** *(pending, recovered from backup)*: M001 Roadmap — stabilize core doctrine, sharpen execution, deepen reliability, keep surfaces coherent, prepare ACE convergence
## Key Verification Commands
```bash
# Run full test suite
npm run test
# Build core
npm run build:core
# Type check extensions
npm run typecheck:extensions
# Lint
npm run lint
# Rust checks
for d in "rust-engine" "rust-engine/crates/ast" "rust-engine/crates/engine" "rust-engine/crates/grep"; do
(cd "$d" && cargo check && cargo test -- --test-threads=2 && cargo clippy -- -D warnings)
done
```

94
.sf/REQUIREMENTS.md Normal file
View file

@ -0,0 +1,94 @@
---
generated: 2026-05-10T03:56:00Z
---
# Requirements
This file captures the explicit capability and coverage contract for SF.
## Active
### R001 — Doctrine Alignment
- Class: core-capability
- Status: active
- Description: SF's product surfaces (CLI help, system prompt, summarization prompt) explicitly frame SF as a "purpose-driven software compiler" instead of a generic "AI coding assistant".
- Why it matters: ADR-0000 defines SF's product contract. Product surfaces that describe SF as a "coding assistant" violate the contract and confuse users and LLMs about SF's nature.
- Source: M001-6377a4/S01 planning
- Primary owning slice: M001-3hf5k0/S01
- Supporting slices: none
- Validation: unmapped
- Notes: Target files confirmed by grep; mechanical string replacements only
### R002 — DB State Integrity
- Class: quality-attribute
- Status: active
- Description: SF's SQLite DB (`.sf/sf.db`) must be readable and not malformed. Recovery from backup must restore the full planning state.
- Why it matters: Without a readable DB, SF blocks all milestone planning and autonomous execution.
- Source: M001-6377a4/S01 planning
- Primary owning slice: M001-3hf5k0/S01
- Supporting slices: none
- Validation: unmapped
- Notes: Backup at `.sf/backups/db/sf.db.2026-05-10T02-42-23-822Z` contains M001-6377a4 with 5 slices and 1 task
## Deferred
### R003 — A2A Adoption
- Class: integration
- Status: deferred
- Description: Adopt A2A as the internal agent communication protocol, wrapping MessageBus as transport.
- Why it matters: Standardizes agent messaging semantics without replacing the SQLite-backed MessageBus infrastructure.
- Source: docs/plans/A2A_ADOPTION_PLAN.md
- Primary owning slice: none (Tier 1)
- Supporting slices: none
- Validation: unmapped
- Notes: 6-phase migration plan exists in docs/plans/A2A_ADOPTION_PLAN.md
### R004 — Unified Dispatch Architecture
- Class: architecture
- Status: deferred
- Description: Merge parallel-orchestrator and slice-parallel-orchestrator into WorktreeOrchestrator, then extract DispatchService API.
- Why it matters: Eliminates ~80% code duplication between the two orchestrators and provides a unified dispatch surface.
- Source: docs/plans/UNIFIED_DISPATCH_V2.md
- Primary owning slice: none (Phase 1 = Week 1)
- Supporting slices: none
- Validation: unmapped
- Notes: 6-phase plan; Phase 1 is merge (highest value, lowest risk)
### R005 — DB Schema Separation
- Class: quality-attribute
- Status: deferred
- Description: Normalize milestone/slice/task tables into spec + runtime + evidence tables per ADR-0077.
- Why it matters: Clear semantics (spec=intent, runtime=state, evidence=history), better query performance, auditability.
- Source: docs/adr/0077-spec-runtime-evidence-schema-separation.md
- Primary owning slice: none (v3.0 target)
- Supporting slices: none
- Validation: unmapped
- Notes: Proposed; implementation phased across milestone tables first
## Out of Scope
### R010 — MCP Server
- Class: anti-feature
- Status: out-of-scope
- Description: SF must not ship or revive an MCP server package or runtime endpoint.
- Why it matters: SF-owned tools must remain native SF/pi tools per .sf/ANTI-GOALS.md.
- Source: .sf/ANTI-GOALS.md
- Notes: SF may consume external MCP servers as a client.
## Traceability
| ID | Class | Status | Primary owner | Supporting | Proof |
|---|---|---|---|---|---|
| R001 | core-capability | active | M001-3hf5k0/S01 | none | unmapped |
| R002 | quality-attribute | active | M001-3hf5k0/S01 | none | unmapped |
| R003 | integration | deferred | none | none | unmapped |
| R004 | architecture | deferred | none | none | unmapped |
| R005 | quality-attribute | deferred | none | none | unmapped |
| R010 | anti-feature | out-of-scope | none | none | n/a |
## Coverage Summary
- Active requirements: 2
- Mapped to slices: 2
- Validated: 0
- Unmapped active requirements: 0

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -42,8 +42,7 @@ After `buildSystemPrompt()`, extensions can further modify via `before_agent_sta
When no SYSTEM.md exists, pi uses its built-in base: When no SYSTEM.md exists, pi uses its built-in base:
``` ```
You are an expert coding assistant operating inside pi, a coding agent harness. You are a purpose-driven software compiler. You take bounded intent, produce a falsifiable purpose contract (the PDD/TDD gate), then write failing tests before implementation. You help users by reading files, executing commands, editing code, and writing new files.
You help users by reading files, executing commands, editing code, and writing new files.
Available tools: Available tools:
- read: Read file contents - read: Read file contents

View file

@ -235,7 +235,7 @@ export function parseArgs(
} }
export function printHelp(): void { export function printHelp(): void {
console.log(`${chalk.bold(APP_NAME)} - AI coding assistant with native read/search/edit/write tools console.log(`${chalk.bold(APP_NAME)} - Purpose-driven software compiler. Takes bounded intent, produces verified software via PDD/TDD gates.
${chalk.bold("Usage:")} ${chalk.bold("Usage:")}
${APP_NAME} [options] [@files...] [messages...] ${APP_NAME} [options] [@files...] [messages...]
@ -252,7 +252,7 @@ ${chalk.bold("Options:")}
--provider <name> Provider name (default: google) --provider <name> Provider name (default: google)
--model <pattern> Model pattern or ID (supports "provider/id" and optional ":<thinking>") --model <pattern> Model pattern or ID (supports "provider/id" and optional ":<thinking>")
--api-key <key> API key (defaults to env vars) --api-key <key> API key (defaults to env vars)
--system-prompt <text> System prompt (default: coding assistant prompt) --system-prompt <text> System prompt (default: purpose-driven development agent prompt)
--append-system-prompt <text> Append text or file contents to the system prompt --append-system-prompt <text> Append text or file contents to the system prompt
--mode <mode> Output mode: text (default), json, or rpc --mode <mode> Output mode: text (default), json, or rpc
--print, -p Non-interactive mode: process prompt and exit --print, -p Non-interactive mode: process prompt and exit

View file

@ -304,6 +304,6 @@ export function serializeConversation(messages: Message[]): string {
// Summarization System Prompt // Summarization System Prompt
// ============================================================================ // ============================================================================
export const SUMMARIZATION_SYSTEM_PROMPT = `You are a context summarization assistant. Your task is to read a conversation between a user and an AI coding assistant, then produce a structured summary following the exact format specified. export const SUMMARIZATION_SYSTEM_PROMPT = `You are a context summarization assistant. Your task is to read a conversation between a user and a purpose-driven software compiler, then produce a structured summary following the exact format specified.
Do NOT continue the conversation. Do NOT respond to any questions in the conversation. ONLY output the structured summary.`; Do NOT continue the conversation. Do NOT respond to any questions in the conversation. ONLY output the structured summary.`;

View file

@ -256,7 +256,7 @@ export function buildSystemPrompt(
const guidelines = guidelinesList.map((g) => `- ${g}`).join("\n"); const guidelines = guidelinesList.map((g) => `- ${g}`).join("\n");
let prompt = `You are an expert coding assistant operating inside pi, a coding agent harness. You help users by reading files, executing commands, editing code, and writing new files. let prompt = `You are a purpose-driven software compiler. You take bounded intent, produce a falsifiable purpose contract (the PDD/TDD gate), then write failing tests before implementation. You help users by reading files, executing commands, editing code, and writing new files.
Available tools: Available tools:
${toolsList} ${toolsList}