Highlights
This is a major infrastructure release that transforms Formic from a single-task sequential executor into a concurrent, self-healing agent orchestration platform. Multiple agents now execute tasks in parallel with file-level conflict prevention. High-level goals are automatically decomposed into dependency-aware task graphs. A built-in verification loop detects errors and creates fix tasks automatically. Agents learn from past mistakes through persistent memory.
Install
npm install -g @rickywo/formic
Upgrade
npm update -g @rickywo/formic
What's New
Lease-Based File Concurrency
- Multiple agents execute tasks in parallel with file-level conflict prevention
- Exclusive leases: One task at a time per file (write access)
- Shared leases: Multiple tasks can hold read-only access simultaneously
- Optimistic concurrency on shared files via
git hash-object collision detection
- Task yielding with exponential backoff (2s → 60s) when lease conflicts arise
- Priority-based lease preemption for high-priority tasks
- DFS-based deadlock detection and automatic resolution
- Lease persistence to
.formic/leases.json for crash recovery
Goal Task Decomposition (DAG Scheduling)
- New
goal task type for high-level objectives
- Architect skill decomposes goals into 3–8 dependency-aware child tasks
- Child tasks are linked via
parentGoalId / childTaskIds
- DAG dependency resolution: blocked tasks auto-queue when all dependencies reach
done
- Cycle detection with fallback to flat execution
Self-Healing Execution Loops
- Configurable verification step (
VERIFY_COMMAND) runs post-execution
- Automatic retry on verification failure with safe-point rollback
- Auto-creates high-priority fix tasks when errors persist
- Kill switch pauses queue after max retries to prevent infinite loops
- Git safe-point commits before each task execution for rollback support
Persistent Agent Memory
- Memory store at
.formic/memory.json captures lessons learned
- Relevance scoring: tag overlap (+2), file path boost (+3), recency decay
- Top 5 relevant memories injected into agent context per task
- Memory types:
pattern, pitfall, preference
Reusable Tool Forging
- Agents can create and register shell commands during execution
- Tool catalog persisted at
.formic/tools/tools.json
- Registered tools injected into agent prompts for reuse
- Validation enforces kebab-case names and non-empty fields
Lease Watchdog
- Background scanner (30s interval) cleans up expired leases
- Kills orphaned agent processes and reverts uncommitted changes
- Re-queues affected tasks and runs deadlock detection
- Configurable via
WATCHDOG_INTERVAL_MS
DAG-Aware Queue Prioritization
- 4-tier scoring algorithm for optimal task ordering:
- Fix-task bonus (+1000) for self-healing fast-path
- Unblocking potential (+100 per transitively blocked task)
- Manual priority (high/medium/low)
- FIFO age tiebreaker
- Queue analysis API endpoint for observability
New Task Statuses
| Status |
Description |
declaring |
Task is declaring which files it will modify |
architecting |
Goal task being decomposed into child tasks |
verifying |
Post-execution verification in progress |
blocked |
Waiting for DAG dependencies to complete |
UI Enhancements
- New
verifying kanban column (6-column board layout)
- Goal task, child task, and blocked badges on task cards
- Dependency pills showing blocked-by relationships
- Task type selector (standard / quick / goal) in creation form
- Light and dark theme support for all new elements
CLI Improvement
formic start no longer requires formic init first — auto-initializes on startup
Internal Events Bus
- Lightweight
EventEmitter for decoupled service communication
TASK_COMPLETED and LEASE_RELEASED events wake the queue processor immediately
New API Endpoints
| Method |
Endpoint |
Description |
GET |
/api/tasks/:id/children |
Get child tasks for a goal |
POST |
/api/tasks/:id/lease/acquire |
Acquire file leases |
POST |
/api/tasks/:id/lease/release |
Release file leases |
POST |
/api/tasks/:id/lease/renew |
Renew file leases |
GET |
/api/leases |
List all active leases |
GET |
/api/tasks/:id/declared-files |
Get file declarations |
GET |
/api/queue/analysis |
Queue scoring breakdown |
GET |
/api/tools |
List registered tools |
POST |
/api/tools |
Register a new tool |
Environment Variables
| Variable |
Default |
Description |
MAX_CONCURRENT_TASKS |
1 |
Maximum parallel task executions |
MAX_YIELD_COUNT |
50 |
Max lease-conflict yields before skipping |
VERIFY_COMMAND |
(empty) |
Shell command for post-execution verification |
SKIP_VERIFY |
false |
Skip verification step entirely |
WATCHDOG_INTERVAL_MS |
30000 |
Lease watchdog scan interval (ms) |
New Skills
| Skill |
Description |
architect |
Decomposes a goal into 3–8 child tasks with dependency graph |
declare |
Analyzes task plan to declare exclusive/shared file lists for lease acquisition |
Test Suite
10 new test files covering the concurrency infrastructure:
- Lease acquisition and conflict detection
- DAG dependency resolution and priority scoring
- Lease preemption and deadlock detection
- Memory persistence and relevance scoring
- Queue scoring algorithm validation
- Verification step and self-healing retry loops
- Safe-point commits and rollback
- Tool registration and usage tracking
- End-to-end integration scenarios
Full Changelog
v0.5.1...v0.7.0