Commit Graph

1419 Commits

Author SHA1 Message Date
freemo 0d5d9cf051 fix(cli): add Settings and Actor Details panels to session create rich output (#1547)
Implements issue #1547. The agents session create command now displays Settings and Actor Details panels per specification.

Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
2026-04-02 21:46:15 +00:00
freemo 23edfe3d15 fix(cli): add Automation field and success message to session show rich output (#1548)
Implements issue #1548. The agents session show command now displays the Automation field and success message per specification.

Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
2026-04-02 21:46:14 +00:00
freemo 1a07a891ca fix(cli): render spec-required Filters, Summary panels and Elapsed column in agents plan list rich output (#1522)
Implements issue #1522. The agents plan list command now displays spec-compliant rich output with proper table columns, Filters panel, Summary panel, and success message.

Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
2026-04-02 21:39:20 +00:00
freemo e069a2edde fix(cli): render Actor Removed, Impact, and Cleanup panels for actor remove command (#1524)
Implements issue #1524. The agents actor remove command now displays the spec-required Actor Removed, Impact, and Cleanup panels, plus success message.

Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
2026-04-02 21:36:56 +00:00
freemo 7f626a7a47 fix(cli): add Summary panel and success message to actor list rich output (#1525)
Implements issue #1525. The agents actor list command now displays the spec-required Summary panel with statistics and success message.

Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
2026-04-02 21:36:40 +00:00
freemo 71ce95fdf6 docs(specification): reorder command synopsis to separate validation commands (#1552)
Implements issue #1552. Reorders the command synopsis in the specification to logically group validation commands separately from regular commands for better clarity.

Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
2026-04-02 21:30:26 +00:00
freemo 09be821a38 fix(cli): make version command show actual git commit (#1520)
Implements issue #1520. The version command now displays the actual git commit SHA to help identify which version of the code is running.

Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
2026-04-02 21:30:05 +00:00
freemo f862bcb256 Merge pull request 'fix(provider): make LangChainChatProvider name and model_id mutable properties (#1553)' (#1558) from fix/provider-immutable-properties into master 2026-04-02 21:13:37 +00:00
freemo 6a6ce518bf fix(provider): make LangChainChatProvider name and model_id mutable properties
The LangChainChatProvider class defined name and model_id as read-only
properties without setters, causing AttributeError when PlanService
attempted to set these properties after provider instantiation.

Root Cause:
- LangChainChatProvider.name and .model_id were @property without @setter
- PlanService._resolve_ai_provider_for_actor() attempts to mutate these
  properties at lines 411 and 413
- This caused: AttributeError: property 'name' of 'LangChainChatProvider'
  object has no setter

Solution:
Added property setters for both name and model_id:
  @name.setter
  def name(self, value: str) -> None:
      self._name = value

  @model_id.setter
  def model_id(self, value: str) -> None:
      self._model_id = value

This allows PlanService to correctly resolve provider names and model IDs
without raising AttributeError.

Impact:
- Fixes the agents build command crash when using agents tell
- No regression: existing functionality unchanged
- Properties remain type-safe (str -> str)

ISSUES CLOSED: #1553
2026-04-02 21:12:08 +00:00
freemo d318d92d1f docs(timeline): update schedule adherence Day 53 (2026-04-02)
Late-day refresh: Open PRs 50→68 (+18 new fix PRs for UAT findings),
open issues 362→342 (-20 closed), open bugs 155→143 (-12 fixed).
Milestones: M3 85% (197/231), M4 80% (99/124), M5 89% (126/142),
M6 77% (165/214), M7 75% (112/149), M8 44% (36/81), M9 40% (17/42).
Recent merges: #1498 (tool add YAML), #1481 (session checksum),
#1479 (TUI CSS), #1338 (persona export/import).
2026-04-02 20:54:36 +00:00
freemo 7f5a330f23 docs(changelog): add Fixed entries for PRs #1498, #1481, #1479
- tool add: handle tool: wrapper key (#1471)
- session export: sha256: prefix checksum (#1450)
- ThoughtBlockWidget: correct background color (#1448)

ISSUES CLOSED: #1471 #1450 #1448
2026-04-02 20:21:43 +00:00
freemo c81afea06b docs(timeline): update schedule adherence Day 53 (2026-04-02)
End-of-day refresh: UAT supervisor fleet (cycles 11-131) discovered 100+
spec compliance bugs, surging open bug count from 50 to 155. M8 (v3.7.0)
net regression from 60% to 55% (36/65) due to 29 new UAT issues. Updated
milestone completion rates, gantt chart legend, risk register, current
status summary, and schedule adherence entry with end-of-day data.

Key changes:
- Open bugs: 50 → 155 (+105 UAT discoveries)
- Open PRs: 47 → 50 (+3 new UAT/bug PRs)
- Open issues: 289 → 362 (+73 new UAT/refactor/bug issues)
- M3 83% (190/227), M4 77% (89/115), M5 88% (126/143)
- M6 78% (165/211), M7 75% (114/152), M8 55% (36/65), M9 42% (17/40)
2026-04-02 19:50:26 +00:00
freemo 0022c9c035 fix(cli): handle tool: wrapper key in agents tool add YAML config #1471 (#1498)
Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
2026-04-02 19:33:36 +00:00
freemo 71177c6e1a docs: update changelog, API docs, and architecture for 2026-04-02 merged PRs
- CHANGELOG: add [Unreleased] entries for TUI first-run experience (#1391),
  session Markdown export (#1004), and UKO provenance/temporal versioning (#891)
- README: add first-run experience and Markdown transcript export bullets
- docs/api/tui.md: new TUI API reference covering first-run, persona system,
  input routing, slash commands, session export/import, and widgets
- docs/api/index.md: add TUI entry to module index
- docs/api/resource.md: document DatabaseResourceHandler and DevcontainerHandler
  full protocol implementations with method tables and examples
- docs/architecture.md: expand UKO section with provenance/temporal versioning
  details; update TUI design decision summary
- mkdocs.yml: add TUI page to API Reference nav

ISSUES CLOSED: #1391 #1004 #891
2026-04-02 19:30:53 +00:00
freemo b96154d612 fix(session): session export checksum stored with sha256 prefix per spec #1450 (#1481)
Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
2026-04-02 19:29:50 +00:00
freemo 19d4771aa2 fix(tui): use $primary-muted background for ThoughtBlockWidget per spec #1448 (#1479)
Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
2026-04-02 19:29:49 +00:00
freemo d2322b3206 build(agents): add test infrastructure improver and project owner agents (13 supervisors)
Adds two new agent types to the autonomous system, bringing the total
from 11 to 13 supervisors launched by the product-builder via prompt_async.

New agents:

1. ca-test-infra-improver (12th supervisor — pool with N workers):
   Dual-mode agent following the ca-bug-hunter pattern. In pool mode,
   dispatches N parallel workers via prompt_async to analyze 8 aspects
   of the testing infrastructure: CI execution time, coverage gaps, test
   architecture (BDD quality), flaky tests, CI pipeline optimization,
   test data quality, missing test levels (Behave/Robot/ASV per
   CONTRIBUTING.md), and dependency security. Workers file actionable
   Type/Testing or Type/Task issues. Hard constraint: never disables
   or weakens existing checks — only proposes additions and optimizations.
   Uses Gemini 2.5 Pro for large context. Follows all established patterns
   (clone isolation, bash sleep, prompt_async dispatch, session resume,
   bot signature).

2. ca-project-owner (13th supervisor — singleton, no pool):
   Acts as autonomous project owner. Continuously triages State/Unverified
   issues following CONTRIBUTING.md's 6-step triage process. Assigns
   MoSCoW labels (Must Have / Should Have / Could Have) based on the
   specification and milestone goals. Makes strategic priority decisions.
   Tags specific developers with questions in Forgejo comments (discovers
   expertise from git history and Forgejo assignments). Periodically
   re-evaluates MoSCoW labels as the project evolves. Follows up on
   unanswered questions after 48 hours. Single instance, not a pool —
   one project owner is sufficient. Uses Opus for nuanced strategic
   judgment. Launched via prompt_async like all other supervisors.

Modified files:

- product-builder.md: Updated from 11 to 13 supervisors in all locations
  (architecture table, Phase C.2 launch list with entries #12 and #13,
  validation count, checkpoint text, self-coordinate table). Added
  test-infra-pool to pool supervisors list and project-owner to singletons.

- ca-human-liaison.md: Clarified MoSCoW responsibility split — the liaison
  only adjusts MoSCoW labels when relaying explicit human feedback. The
  ca-project-owner handles autonomous MoSCoW assignment.
2026-04-02 15:19:53 -04:00
freemo 48cff5cfe0 refactor(cli): rename plan lifecycle-list and lifecycle-apply to match specification
Renames `plan lifecycle-list` to `plan list` and `plan lifecycle-apply` to `plan apply` to align with the specification's canonical command names. Removes legacy V2 plan commands that occupied those names.

- Renamed CLI command registrations from lifecycle-list/lifecycle-apply to list/apply
- Removed legacy V2 apply and list commands (~200 lines)
- Updated apply shortcut in main.py to delegate to v3 lifecycle
- Added defensive null check for plan existence in apply command
- Updated 63+ test, doc, and benchmark files for consistency

Closes #881

Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
2026-04-02 19:09:04 +00:00
freemo 908d5854a3 Merge pull request 'fix(test): remove lingering @tdd_expected_fail tags for closed bugs #797 and #1028' (#1185) from feature/m3-tdd-tag-cleanup into master 2026-04-02 19:08:28 +00:00
arch-guard 136c27a337 docs(timeline): update schedule adherence Day 53 (2026-04-02)
Mid-day refresh: 47 open PRs (+2), 289 open issues (+15 new UAT/refactor
issues in v3.7.0 backlog). v3.5.0 advanced to 78% (164/209, +2 closed).
v3.7.0 at 60% (36/60, +1 new issue). 50 open bugs stable.

Updated sections: Gantt chart update log, footer, risk register legend,
Current Status Summary, What Remains To Be Done, Day 53 schedule adherence
entry (task inventory with per-developer breakdown).
2026-04-02 19:04:05 +00:00
freemo e9c96c3d0c docs: add API reference and architecture overview
Add docs/api/ with per-module API documentation for core, a2a, actor,
skills, tool, mcp, resource, and config packages. Add docs/architecture.md
with a developer-oriented system overview including component map, layer
diagram, plan lifecycle, and key design decisions. Update mkdocs.yml nav
to expose both new sections.

ISSUES CLOSED: #N/A
2026-04-02 19:02:53 +00:00
freemo 7e38aad929 build(agents): force prompt_async by removing supervisors from task permissions
The product-builder was ignoring the prompt_async instructions and falling
back to the Task tool for launching supervisors. It was also only launching
a few supervisors instead of all 11 because the pseudocode was too abstract.

Root cause: All 11 supervisor agents were listed in the task permissions,
so the LLM had a choice between Task (familiar, simpler) and bash curl
(correct but unfamiliar). It chose Task every time.

Fix — three changes:

1. REMOVED all 11 supervisor agents from task permissions. The product-
   builder physically cannot invoke them via the Task tool anymore. Only
   one-shot agents remain in task permissions (ca-epic-planner,
   ca-session-persister, ca-product-verifier, ca-ref-reader, etc.).

2. REWROTE Phase C.2 as concrete curl command templates instead of
   abstract pseudocode. The agent now has the exact curl pattern to
   copy-paste for each supervisor, with clear variable placeholders.
   Added a mandatory validation step: wc -l the tracking file and
   confirm exactly 11 entries before proceeding.

3. ADDED aggressive warnings at three levels:
   - Top of file: bold mandatory notice about prompt_async
   - Phase C.2: large boxed warning block prohibiting the Task tool
   - Coordination rules: explicit statement that supervisors are
     removed from task permissions
   - Monitoring loop: reminder to use bash curl for re-launches
2026-04-02 18:52:09 +00:00
freemo 4ecf446360 build(agents): open bash permissions to allow complex commands
Agents were failing when trying to run complex bash commands (curl with
pipes to python3, multi-command pipelines, etc.) because their bash
permissions were set to '"*": deny' with only specific simple patterns
allowed (e.g., "curl *": allow). Shell pipelines like:

  curl -s http://localhost:4096/session | python3 -c "import json..."

don't match any single allow pattern and get denied.

Changed 17 agent files from restrictive bash permissions to '"*": allow'.
This includes all agents that need to:
- Run curl pipelines with python3 for prompt_async session management
- Create Forgejo dependency links via REST API curl calls
- Execute complex git operations with pipes
- Run bash sleep for polling loops

Only 3 truly read-only analysis agents remain restricted:
ca-difficulty-evaluator, ca-implementation-reviewer, ca-issue-analyzer.
These don't need bash access at all.
2026-04-02 18:36:23 +00:00
freemo 3e9de4ca21 build(agents): enforce CONTRIBUTING.md label, milestone, and dependency compliance
Issues and PRs created by agents were missing required labels, milestones,
and Forgejo dependency links per CONTRIBUTING.md. This commit adds explicit
API call instructions and a continuous compliance audit to fix the gaps.

Changes across 6 agent definitions:

- ca-new-issue-creator: Added curl bash permission. Added explicit
  post-creation compliance steps: set labels (State/Unverified, Type/*,
  Priority/*) via forgejo_add_issue_labels, set milestone via
  forgejo_update_issue, create parent Epic dependency link via REST API
  (POST /issues/{child}/blocks with parent Epic number — correct direction:
  child blocks parent). Added compliance verification step.

- ca-epic-planner: Added curl bash permission. Added post-creation API
  call checklists for both Epics (labels, Legendary link) and child issues
  (labels, milestone, Epic dependency link, inter-issue dependency links).
  Added compliance verification step.

- ca-backlog-groomer: Added curl and sleep bash permissions. Expanded
  Pass 4 (Label Quality) to auto-fix missing labels (State, Type, Priority)
  and milestones via Forgejo API. Added PR label/milestone compliance
  checking. Added new Pass 9 (Dependency Link Compliance) to auto-fix
  missing parent Epic links, PR-to-issue links, and wrong dependency
  direction. Added new Pass 10 (Issue Body Compliance) to flag missing
  Metadata, Subtasks, and Definition of Done sections.

- ca-pr-api-creator: Added curl bash permission. Replaced vague "add
  dependency" instruction with explicit REST API curl call for creating
  PR-blocks-issue dependency link. Added post-creation compliance
  verification step.

- ca-agent-evolver: Added Priority/Backlog label and milestone assignment
  to proposal issues.

- ca-spec-updater: Added Priority/Backlog label and milestone assignment
  to proposal issues.
2026-04-02 18:28:08 +00:00
freemo 270160eca9 build(agents): add proposal issue gate before spec and agent-definition PRs
Both the spec-updater and agent-evolver previously skipped straight to
creating PRs with 'needs feedback' for proposed changes. The user needs
a two-step human-approval workflow:

Step 1: Agent creates a PROPOSAL ISSUE with 'needs feedback' label
  describing what it wants to change and why. No branch, no code changes.
Step 2: Human reviews the issue and approves it (by removing 'needs
  feedback', adding 'State/Verified', or commenting with approval).
Step 3: Agent detects approval, normalizes labels, creates branch + PR
  (also with 'needs feedback') implementing the approved change.
Step 4: Human reviews the PR and merges it.

Changes across 3 agent definitions:

- ca-agent-evolver: Step 4 split into proposal issue creation (Step 4)
  and approved-proposal implementation (Step 5). Added pending_proposals
  and pending_prs state tracking. Approval detected via 3 signals:
  label removal, State/Verified addition, or human approval comment.

- ca-spec-updater: Removed the minor/major classification and the
  "commit directly to master" path. ALL spec changes now go through
  proposal issues first (Step 6a creates issue, Step 7 monitors for
  approval). Added pending_spec_proposals and rejected_proposals state.
  Approval check runs every cycle before checking for new merged PRs.

- ca-human-liaison: Added Step 4 guard — issues with 'needs feedback'
  label are NOT auto-verified. The liaison acknowledges them with a
  comment but does not change state labels. Only issues WITHOUT 'needs
  feedback' proceed to the normal auto-verify flow (now Step 5).
2026-04-02 14:19:56 -04:00
freemo ed449f1b2b docs(timeline): update schedule adherence Day 53 (2026-04-02)
- Update gantt charts: M3 85%, M4 78%, M5 89%, M6 78%, M7 76%, M8 61%, M9 42%
- Update footer: 50 open bugs, 45 open PRs (down from 65/86)
- Update GANTT UPDATE LOG: v3.7.0 push, 55+ PRs merged
- Update Current Status Summary: 45 open PRs, 274 open issues, 50 bugs
- Append v3.7.0 second merge wave bullet (10 additional PRs)
- Update What Remains: M8 61%, M9 42%, 45 open PRs, 50 bugs
- Update Milestone Roadmap: M3/M4/M5/M6/M8 status sections
- Update Schedule Risk Summary: 45 PRs, 50 bugs, M8 61%
- Update Day 53 schedule adherence entry: two merge waves, updated forecasts
2026-04-02 18:19:47 +00:00
freemo d0ef563175 feat(mcp): implement lazy start/auto-stop and sandbox path rewriting for MCP tools
Add lifecycle management and sandbox support for MCP tools:

- McpClient: lazy start, configurable idle timeout with auto-stop, health monitoring with automatic restart
- McpRegistry: namespace-isolated tracking of multiple MCP servers
- SandboxPathRewriter: bi-directional file path rewriting between host and sandbox workspaces
- MCPCapabilityMetadata: structured exposure of full MCP server capabilities
- 26 BDD scenarios covering lifecycle, sandbox rewriting, and edge cases

ISSUES CLOSED: #938
2026-04-02 18:18:40 +00:00
freemo 9bbec0e698 build(agents): prompt_async for pool supervisors, session resume, bot signatures, cleanup agent
Four changes in one commit across 27 agent files:

1. POOL SUPERVISOR PROMPT_ASYNC: All 4 pool supervisors (issue-implementor,
   ca-continuous-pr-reviewer, ca-uat-tester, ca-bug-hunter) now dispatch
   their internal workers via the OpenCode Server's prompt_async endpoint
   instead of the Task tool. This eliminates the wait_for_all bottleneck
   at the supervisor level — workers run independently, and a 10-second
   polling loop detects completions and immediately refills vacant slots.
   Added curl/sleep bash permissions where needed. Each supervisor keeps
   N workers running at all times with zero idle slots.

2. SESSION RESUME INSTEAD OF CLEANUP: The product-builder and all 4 pool
   supervisors now RESUME existing sessions from a previous interrupted
   run instead of aborting them. Phase C.0 queries the server for sessions
   titled "[CA-AUTO] supervisor:*" and adopts any that are still active
   into the monitoring loop. Pool supervisors similarly adopt existing
   "[CA-AUTO] worker-*" sessions. This enables "continue where you left
   off" — restarting the product-builder reconnects to running supervisors
   and workers rather than duplicating them.

3. DEDICATED CLEANUP AGENT: New ca-session-cleanup.md primary agent for
   explicit fresh-start cleanup. Run this BEFORE the product-builder when
   you want to abort all previous sessions and start completely fresh. It
   finds all "[CA-AUTO]" sessions, aborts them, and deletes them. This is
   the ONLY way to kill old sessions — the product-builder never does it
   automatically.

4. BOT SIGNATURES: All 26 agents that post content to Forgejo now include
   a mandatory "Bot Signature" section requiring every comment, issue body,
   PR description, and review to end with:

   ---
   **Automated by CleverAgents Bot**
   Supervisor: <category> | Agent: <agent-name>

   24 agents have hardcoded categories. 2 shared agents (ca-new-issue-creator,
   ca-epic-planner) use a parameter-based category from their caller's prompt.
2026-04-02 14:01:43 -04:00
freemo 79403188f6 build(agents): add stale supervisor cleanup at startup to prevent duplicates
When the product-builder is interrupted mid-run (Ctrl+C, crash, timeout),
supervisor sessions launched via prompt_async survive independently on the
OpenCode server. Restarting the product-builder without cleanup creates
duplicate supervisors — 22 agents competing for the same work, causing
duplicate PR reviews, conflicting git pushes, and wasted resources.

Added Phase C.0 (runs before planning or launching) that:
1. Queries GET /session for all server sessions
2. Filters for sessions with titles starting with "[CA-AUTO] supervisor:"
3. Aborts any that are still active via POST /session/:id/abort
4. Deletes the stale sessions via DELETE /session/:id
5. Cleans up the /tmp/ca-supervisor-sessions.env tracking file
6. Logs the cleanup count to the session state issue

Also changed the supervisor session title convention from
"supervisor: <name>" to "[CA-AUTO] supervisor: <name>" to reliably
distinguish product-builder-managed sessions from user-created ones.
2026-04-02 14:01:36 -04:00
freemo 2a266929fd Merge pull request 'bug(cli): automation_profile._get_service() bypasses DI container' (#1181) from bugfix/m4-automation-profile-di-bypass into master 2026-04-02 17:54:14 +00:00
freemo 7e4301066c Merge pull request 'refactor(cli): move context commands to actor context subgroup' (#1194) from feature/m4-actor-context-hierarchy into master 2026-04-02 17:53:42 +00:00
freemo 3fe1974249 docs(timeline): update schedule adherence Day 53 (2026-04-02)
- Updated Day 53 entry with end-of-day data (32 PRs merged today)
- Open PRs: 119 → 86 (down 33)
- Open bugs: 40 → 65 (up 25, UAT testing discovered new issues)
- Milestone progress: M3 74%→79%, M4 74%→75%, M5 78%→87%, M6 69%→74%, M7 61%→71%, M8 50%→54%
- Updated gantt chart completion percentages and risk register
- Updated Current Status Summary with end-of-day figures
- Added Day 53 merge wave bullet to What Has Been Completed
- Updated What Remains To Be Done with current open counts
- Updated Schedule Risk Summary with UAT findings
2026-04-02 17:41:12 +00:00
freemo bcf54d08c9 Merge pull request 'feat(plugin): register spec-defined extension points in PluginManager' (#1217) from feature/plugin-extension-points into master 2026-04-02 17:40:18 +00:00
freemo 085f71a69d feat(ci): add Helm chart lint and template validation to CI
Add kubeconform manifest validation to the existing helm CI job.
The helm job already had helm lint and helm template steps (added in
#1085). This commit completes the optional acceptance criterion from
#1089 by adding kubeconform v0.7.0 to validate rendered manifests
against the Kubernetes 1.29.0 schema in strict mode.

Closes #1089
2026-04-02 17:40:00 +00:00
freemo 6c94ad9552 Merge pull request 'fix: add --required/--informational flags to validation add CLI' (#1222) from bugfix/m5-validation-required-flag into master 2026-04-02 17:39:19 +00:00
freemo 0d4c5b6ff1 docs: add v3.7.0 cycle-2 documentation for UKO runtime, TUI permissions, database handler, and thought blocks
- CHANGELOG.md: extend [3.7.0] section with 15 new entries covering
  PermissionsScreen, ThoughtBlock, UKO runtime services, ACMS Phase 2
  protocol aliases, DevcontainerHandler protocol completion,
  DatabaseResourceHandler CRUD/checkpoint, estimation lifecycle hook,
  user_identity domain events, PLAN_APPLIED/PLAN_CANCELLED enrichment,
  server serve subcommand, async audit refactor, and CLI flag fixes
- README.md: extend Highlights with permissions screen, thought blocks,
  UKO runtime, database handler, and estimation lifecycle
- docs/reference/uko_runtime.md: new reference for UKOQueryInterface,
  UKOInferenceEngine, and UKOGraphPersistence (issue #891)
- docs/reference/tui_permissions.md: new reference for PermissionsScreen,
  PermissionRequestService, and all domain models (issue #996)
- docs/reference/tui_thought_block.md: new reference for ThoughtBlock
  domain model and ThoughtBlockWidget (issue #1001)
- docs/reference/database_handler.md: new reference for
  DatabaseResourceHandler CRUD and checkpoint methods (issue #1241)
- docs/reference/devcontainer_resources.md: add DevcontainerHandler
  protocol methods section (delete, list_children, diff, create_sandbox)
  (issue #1242)
- docs/reference/tui.md: extend architecture table and add Permissions
  Screen and Actor Thought Blocks sections

ISSUES CLOSED: #1393
2026-04-02 17:35:41 +00:00
freemo 62caf63d61 docs(spec): align spec with v3.7.0 cycle-3 implementation discoveries
- DomainEvent: add user_identity and correlation_id fields (PR #1257)
  user_identity carries authenticated user in server mode (None in local
  mode); correlation_id is a ULID linking related events in one request
  chain. Both were implemented but missing from the spec model.

- EventType: promote to StrEnum, add PLAN_ESTIMATION_COMPLETE,
  CORRECTION_APPLIED, CONFIG_CHANGED, ENTITY_DELETED, AUTH_SUCCESS,
  AUTH_FAILURE, TIER_PROMOTED, TIER_DEMOTED, TIER_EVICTED,
  VALIDATION_FIX_ATTEMPTED, VALIDATION_FIX_SUCCEEDED,
  VALIDATION_FIX_EXHAUSTED (all present in implementation, missing from
  spec enum).

- Audit log event details: enrich plan_applied row with changeset
  statistics (lines_added, lines_removed, resources_modified,
  apply_duration) per PR #1300; enrich plan_cancelled row with progress
  context (cancelled_phase, last_completed_step, subplan_count) and
  resource cleanup context (sandbox_refs, changeset_id,
  resources_pending_cleanup) per PR #1301.

- Estimation actor: document 4-level fallback chain wired in
  use_action() (PR #1310) and Strategize-to-Estimate lifecycle hook
  that emits PLAN_ESTIMATION_COMPLETE on success.

ISSUES CLOSED: #1310 #1300 #1301 #1257
2026-04-02 17:34:09 +00:00
freemo f035e2efbd Merge pull request 'feat(tui): implement first-run experience with actor selection overlay' (#1391) from feature/m8-tui-first-run into master 2026-04-02 17:33:44 +00:00
freemo d0515ff1ac feat(tui): implement session export/import (JSON + Markdown)
Add Markdown export format for sessions alongside the existing JSON export.
Implement TUI slash command routing for /session:export and /session:import.

- Add Session.as_export_markdown() domain method producing a human-readable
  Markdown transcript (lossy, not importable — for sharing/documentation)
- Extend CLI 'agents session export' with --format flag (json|md)
- Extend TuiCommandRouter._session_command() to handle 'export' and 'import'
  subcommands, delegating to the session service via the DI container
- Add 16 Behave scenarios covering domain model, CLI, and TUI command paths

Closes #1004
2026-04-02 17:30:37 +00:00
freemo eee51b7d54 build(agents): use prompt_async for fire-and-forget supervisor launch + bash sleep for real waiting
Two fundamental architectural changes that solve the "supervisor exits and
never gets relaunched" problem:

1. PROMPT_ASYNC LAUNCH: The product-builder no longer uses the Task tool to
   launch supervisors. The Task tool blocks until ALL parallel tasks return,
   meaning if one supervisor exits, the product-builder can't relaunch it
   until all 10 others also exit. Instead, supervisors are now launched via
   the OpenCode Server HTTP API's POST /session/:id/prompt_async endpoint,
   which returns 204 immediately (true fire-and-forget). The product-builder
   then enters a bash-driven monitoring loop that checks session status
   every 60 seconds via curl and relaunches any dead supervisor instantly
   — independently of whether the other 10 are still running.

   Requires: opencode started with --port 4096 (fixed known port).
   Added curl and sleep to product-builder's bash allow list.

2. BASH SLEEP FOR GENUINE WAITING: All 11 supervisors now use the Bash
   tool with "sleep N" (and explicit timeout > sleep duration) for real
   blocking waits between polling cycles. Previously, pseudocode "wait N
   minutes" was interpreted by the LLM as "I'm done, return to caller" —
   causing supervisors to exit after their first idle cycle. The bash sleep
   call genuinely blocks the agent for the specified duration, then the
   agent resumes its loop. Every supervisor has a prominent instruction
   block explaining this mechanism and warning against returning to caller.

   All idle break/exit conditions removed across all 11 supervisors.
   Supervisors now loop forever: poll Forgejo → do work → bash sleep → repeat.

Changes across 12 agent definitions:

- product-builder: Phase C.2 rewritten to use curl + prompt_async.
  Phase C.3 rewritten as bash sleep + curl monitoring loop (checks every
  60s, relaunches dead supervisors, checks convergence every 10 min).
  Phase C.4 simplified to cleanup only.

- All 11 supervisors: Added "CRITICAL: Bash Sleep" instruction block.
  Replaced all pseudocode "wait N" with bash("sleep N", timeout=N*1.5).
  Removed all idle break/exit conditions — agents now sleep and re-poll
  instead of exiting.
2026-04-02 13:19:51 -04:00
freemo e8fa13d35c docs(spec): align spec with v3.7.0 cycle-2 implementation discoveries
- Add audit.* config key group (audit.retention-days, audit.async,
  audit.queue-maxsize) — PR #1279 added async write-behind queue to
  AuditService; spec had no audit config keys documented
- Document UKO runtime services (UKOQueryInterface, UKOInferenceEngine,
  UKOGraphPersistence) — PR #1312 operationalized UKO runtime; spec
  described UKO conceptually but not the service API
- Add UKOIndexer.index_graph() inference and layer population note

No-action PRs this cycle:
- #1307 (PermissionsScreen): implementation matches spec exactly
- #1310 (estimation actor): spec already documents actor.default.estimation
- #1278 (CorrectionDryRunReport): internal refactor, spec not affected
- #1300/1301 (event enrichment): event payload details not in spec scope
- #1305/1263/1262 (CLI fixes): spec alignment fixes, no spec change needed

ISSUES CLOSED: none (minor clarifications only)
2026-04-02 17:19:30 +00:00
freemo 2e24483947 feat(tui): implement session export/import (JSON + Markdown)
Add Markdown export format for sessions alongside the existing JSON export.
Implement TUI slash command routing for /session:export and /session:import.

- Add Session.as_export_markdown() domain method producing a human-readable
  Markdown transcript (lossy, not importable — for sharing/documentation)
- Extend CLI 'agents session export' with --format flag (json|md)
- Extend TuiCommandRouter._session_command() to handle 'export' and 'import'
  subcommands, delegating to the session service via the DI container
- Add 16 Behave scenarios covering domain model, CLI, and TUI command paths

Closes #1004
2026-04-02 17:16:59 +00:00
freemo 2863b5d1e1 feat(tui): implement first-run experience with actor selection overlay
Implements the first-run experience for the TUI as specified in the
specification's 'First-Run Experience' section (§ TUI Architecture).

On first launch (no personas configured), a centered ActorSelectionOverlay
widget is displayed guiding the user to select an actor. The overlay
supports keyboard navigation (j/k), fuzzy search (/), and confirmation
(enter). Selecting an actor creates a default persona and dismisses the
overlay.

Changes:
- Add src/cleveragents/tui/first_run.py: is_first_run() detection helper
  and create_default_persona_for_actor() setup helper
- Add src/cleveragents/tui/widgets/actor_selection_overlay.py:
  ActorSelectionOverlay widget with show/hide/navigate/search/confirm API
  and render_actor_selection() pure rendering function
- Update src/cleveragents/tui/app.py: integrate first-run check in
  on_mount(), yield ActorSelectionOverlay in compose(), add
  _complete_first_run() method
- Update src/cleveragents/tui/widgets/__init__.py: export
  ActorSelectionOverlay
- Add features/tui_first_run.feature + features/steps/tui_first_run_steps.py:
  comprehensive Behave BDD tests covering all public API paths

ISSUES CLOSED: #1007
2026-04-02 17:12:54 +00:00
freemo 0787f42e2f feat(acms): operationalize UKO runtime with provenance and temporal versioning
Operationalizes the Universal Knowledge Ontology (UKO) runtime per issue #891, implementing provenance tracking, temporal versioning, ACMS context strategy integration, four-layer ontology population, implicit relationship inference, and graph persistence.

New services:
- UKOQueryInterface: typed interface for ACMS context strategies to query UKO classification data
- UKOInferenceEngine: semantic analysis producing implicit triples with confidence 0.7
- UKOGraphPersistence: serialises/restores UKO graph state via JSON or in-memory backends

Modified: uko_indexer_internals.py index_graph() now runs inference and populates uko:layer triples for all four ontology layers.

47 BDD scenarios covering all acceptance criteria.

Closes #891

Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
2026-04-02 17:09:15 +00:00
freemo 4725fdb887 feat(acms): implement pipeline Phase 2 components (Deduplicator, DepthResolver, Scorer, Packer)
Add spec-aligned Protocol type aliases for all Phase 2 (Fragment Fusion) pipeline component interfaces, aligning with docs/specification.md §44794-44856 naming conventions:

- FragmentDeduplicatorProtocol (alias for FragmentDeduplicator)
- DetailDepthResolverProtocol (alias for DetailDepthResolver)
- FragmentScorerProtocol (alias for FragmentScorer)
- BudgetPackerProtocol (alias for BudgetPacker)
- FragmentOrdererProtocol (alias for FragmentOrderer)

Closes #540

Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
2026-04-02 17:09:07 +00:00
freemo ee980ee117 feat(resource): implement DevcontainerHandler missing protocol methods (#1286)
Implements the four missing protocol methods on DevcontainerHandler required by Epic #825 (ResourceHandler Protocol Completion):

- delete(): uses 'devcontainer exec rm -rf' to delete files/dirs inside the container; returns DeleteResult(success=False) for missing/stopped containers rather than raising.
- list_children(): uses 'devcontainer exec ls -1' to enumerate workspace entries; returns an empty list on container failure.
- diff(): compares content hashes between the devcontainer workspace and another filesystem location; uses EMPTY_CONTENT_HASH sentinel to treat both-absent as no-change.
- create_sandbox(): delegates to BaseResourceHandler.create_sandbox with lazy activation (same DETECTED/STOPPED/FAILED guard as resolve()).

All methods raise ValueError for resources with no location.

Adds 18 Behave BDD scenarios covering success paths, failure/stopped-container paths, empty-path edge cases, and ValueError guards.

ISSUES CLOSED: #1242

Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
2026-04-02 17:08:52 +00:00
freemo c2097ee2ed feat(events): enrich PLAN_APPLIED event with changeset statistics from PlanApplyService
Enriches the PLAN_APPLIED domain event with SEC7 audit-logging statistics per docs/specification.md §Audit Logging (issue #716).

Changes:
- PlanLifecycleService.complete_apply() now accepts optional keyword arguments: files_changed, lines_added, lines_removed, resources_modified, apply_duration_seconds (all default to 0). These are included in the PLAN_APPLIED event details dict alongside the existing action_name, phase, and project_names fields.
- PlanApplyService.apply_with_validation_gate() computes changeset statistics from SpecChangeSet.summary() and measures apply duration, then passes all statistics to complete_apply().
- New BDD feature features/plan_applied_event_enrichment.feature with 13 scenarios.

Closes #716

Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
2026-04-02 17:08:38 +00:00
freemo 4a18a15ca5 feat(tui): implement PermissionsScreen with diff view
Implement PermissionsScreen with diff view for tool permission requests.
- 3 diff display modes (unified, side-by-side, context)
- Allow/reject keyboard bindings
- Permission decision persistence
- 62 BDD scenarios covering all components

ISSUES CLOSED: #996

Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
2026-04-02 17:08:13 +00:00
freemo ec52acffb7 feat(resource): implement DatabaseResourceHandler CRUD and checkpoint methods
Implements all missing CRUD and checkpoint methods on DatabaseResourceHandler per issue #1241 (Epic #825 ResourceHandler Protocol Completion):

- read(): SQLite queries sqlite_master for schema; remote returns connection-info
- write(): SQLite executes SQL statements; remote returns not-supported result
- delete(): SQLite executes DROP TABLE IF EXISTS; remote returns not-supported
- list_children(): SQLite lists tables/views from sqlite_master; remote returns []
- diff(): compares schemas via content_hash on both sides
- create_checkpoint(): SQLite creates SAVEPOINT on open connection; remote uses content-hash fallback
- rollback_to(): SQLite executes ROLLBACK TO SAVEPOINT; remote returns not-supported

All methods handle errors gracefully (no unhandled exceptions). Adds comprehensive Behave BDD tests covering all methods for both SQLite and remote database types.

ISSUES CLOSED: #1241

Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
2026-04-02 17:08:05 +00:00
freemo 0989f58dc8 feat(estimation): wire actor.default.estimation config fallback and Strategize-to-Estimate lifecycle hook (#1310)
Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
2026-04-02 17:07:48 +00:00