Commit Graph

202 Commits

Author SHA1 Message Date
Levi Neely 18a6448b37 Add extended linting rules and Acme file addressing (bd-9y4, bd-iti)
Extends lintDescription() with 8 new rules: Acme address format correction
(file:N-N → file:N,N), imperative verb start, vague language detection, how
signal, no first-person voice, forbidden vague phrases, inline code (backticks),
and cross-reference on long descriptions (>150 chars). Updates containsLineRef()
to also recognise #N char-position addresses; adds containsAcmeRegexAddr(),
containsHyphenRange(), and containsBdRef() helpers. Adds 32 tests covering every
rule in beads_lint_test.go.

Updates bot-templates/Conductor (6-question cold-completion gate, File Addressing
section), bot-templates/Taskmaster (File Addressing section with grammar
reference), and skills/beads/SKILL.md (Description Quality section with full lint
rule table and Acme addressing guide).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 13:07:52 +01:00
Levi Neely 312276582b Optimize bead description quality (bd-3bu)
- Add description lint check to beads new command (bd-3bu.3):
  warns to stderr on missing file path, function/line ref, short
  description, or missing acceptance criterion; --no-lint and
  IDEA:-prefixed titles bypass lint

- Add post-completion write-back convention to beads SKILL.md
  (bd-3bu.2): quality ratings good/missing-location/missing-pattern/
  too-vague, plus anti-pattern for closing without a quality comment

- Update Taskmaster prompt with five-field schema, KB query
  requirement, and type-specific templates bug/feature/refactor/idea
  (bd-3bu.1, bd-3bu.4)

- Add P1/P2 cold-completion gate to Conductor prompt (bd-3bu.5):
  five-question checklist before assigning high-priority beads to bots

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 13:07:51 +01:00
Levi Neely 572ac91d86 Set CLAUDE_CONFIG_DIR at startup and propagate to tmux/shell/sandbox
- anvilsrv sets CLAUDE_CONFIG_DIR to ~/.config/anvillm/claude on start
  if not already set in the environment
- Claude backend includes CLAUDE_CONFIG_DIR in its Environment map so
  it is set in the tmux session and exported to the shell
- tmux backend now exports all b.cfg.Environment vars to the shell
  (via sendKeys) in addition to setting them in the tmux environment,
  both on CreateSession and Restart
- cfg/backends/claude.yaml adds CLAUDE_CONFIG_DIR to the sandbox env
  whitelist so landrun passes it through to the Claude process

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 11:49:02 +01:00
Levi Neely 065e4a3295
Add bulk-archive via inline Put notation to inbox and archive windows (#12)
* Add inline Put actions for sessions and tasks windows

Introduce a Put command to both the sessions list and tasks windows,
allowing inline edits via prefixed annotations in the body:

Sessions (cmd/Assist/main.go):
  - `- <id>`              Kill session
  - `~ <id>`              Stop session (graceful)
  - `@ <id> <alias>`      Set alias on session
  - `+ <backend> <path> [alias]`  Start new session

Tasks (cmd/Assist/main.go + internal/p9/beads.go):
  - `- [idx]`   Delete bead
  - `~ [idx]`   Claim bead as user
  - `^ [idx]`   Unclaim bead (clear assignee, reset to open)
  - `x [idx]`   Complete bead
  - `f [idx]`   Fail bead
  - `+ <title>` Create new bead with title pre-filled

Also adds `unclaim` ctl command to BeadsFS and helper functions:
claimBeadAsUser, unclaimBead, completeBead, failBead,
openNewBeadWindowWithTitle.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Add [Failed] [PendingReview] [PendingApproval] filters to tasks window

Extends the tasks window filter bar with three new status filters:

- [Failed]          closed beads whose close_reason != "completed"
- [PendingReview]   beads with status "pending_review"
- [PendingApproval] beads with status "pending_approval"

Implementation details:
- Add CloseReason field (json:"close_reason") to Bead struct so
  fail-vs-complete distinction is available after JSON decode.
- listBeadsWithFilter: add "failed" special case (closed beads with
  non-"completed" close_reason); "pending_review" and
  "pending_approval" fall through the existing status equality path.
- handleTasksWindow: wire Failed/PendingReview/PendingApproval cases
  to set statusFilter and refresh the list.
- refreshTasksWindowWithBeads: update filter bar header line.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Add bulk-archive via inline Put notation to inbox and archive windows

In the inbox window, lines prefixed with "- <shortID>" are parsed on Put
and each matching message is archived (moved to completed). In the archive
window the same notation permanently deletes the message from the archive.

Adds: parseMailEdits, mailEdit type, deleteArchivedMessage in Assist;
DeleteFromCompleted in mailbox.Manager; "delete <msg-id>" command on
user/ctl in the p9 server.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Levi Neely <lkn@darkstar.example.net>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-23 19:58:37 +01:00
Levi Neely 50ae1d0dad Add approval gates: beads schema, Conductor, notification daemon, init scripts
Implements bd-i4h (Approval Gates / Human in the Loop):

beads schema (bd-i4h.4):
- Add StatusPendingApproval/StatusPendingReview local status constants
- Add pending-approval, pending-review, resume ctl commands
- Add agent/beads/pending read endpoint
- Document requires-approval/requires-review label conventions
- Update BEADS.md with full Approval Gates section

Conductor bot (bd-i4h.2):
- Read context prompt from stdin when not a terminal (custom prompt support)
- Extend default prompt with approval gate workflow instructions

Human notification daemon (bd-i4h.1):
- Add scripts/anvillm-inbox-notify: streams agent/events, fires notify-send
  for configurable message types (default: APPROVAL_REQUEST, REVIEW_REQUEST)
- Add services/inbox-notify-runit/: runit service
- Add services/systemd/anvillm-inbox-notify.service: systemd user service
- Add services/sysvinit/anvillm-inbox-notify: SysV LSB init script
- Add services/sysvinit/rc.anvillm-inbox-notify: Slackware rc script

anvilsrv init scripts:
- Add services/sysvinit/anvilsrv: SysV LSB init script
- Add services/sysvinit/rc.anvilsrv: Slackware rc script

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 18:47:23 +01:00
Levi Neely bb721c0429
Fix child relationship handling (#8)
* Fix child relationship handling

* Fix: Remove automatic dependency creation in createSubtask()

Parent-child relationships are hierarchical via ID structure only.
The server was incorrectly creating blocking dependencies between
parent and child beads, causing children to block parents.

---------

Co-authored-by: Levi Neely <lkn@darkstar.example.net>
2026-02-22 16:22:17 +01:00
Levi Neely 49dee87384
Merge pull request #2 from lneely/better-subjects
Make bot prompt send_message instruction dynamic and compact
2026-02-22 09:42:18 +01:00
Levi Neely 407b3732af Replace event queue with in-memory pub-sub event bus
Replaces the TTL-based event queue (internal/events) with a proper
in-memory pub-sub bus (internal/eventbus) backed by simonfxr/pubsub.

The agent/events 9P endpoint is now a streaming subscriber: clients
block on reads and receive one JSON-encoded event per read until they
disconnect. Each open(2) creates a per-connection subscription; clunk
and connection teardown cancel it automatically.

- internal/eventbus/bus.go: new package wrapping simonfxr/pubsub;
  provides Publish(agent, type, data) and Subscribe() -> (chan, cancel)
- internal/events/events.go: deleted
- internal/session/manager.go: SetEventQueue -> SetEventBus; all
  publish sites updated to use eventbus constants
- internal/p9/server.go: fid gains eventCh/eventUnsub fields; Topen
  subscribes, Tread blocks on channel, Tclunk/serve-defer cancel
- cmd/anvilsrv/main.go: wired to SetEventBus

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 09:38:14 +01:00
Levi Neely 27610dd878 Remove all deprecated message types
Drop PROMPT, QUESTION, ANSWER, STATUS_UPDATE, and ERROR_REPORT
constants and their handling in ValidateMessageType.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 09:16:38 +01:00
Levi Neely e8f1f4f9be Remove LOG_* message types entirely
LOG_ERROR and LOG_INFO are no longer supported. Remove the constants,
drop them from ValidateMessageType, update ERROR_REPORT deprecation
notice to point to PROMPT_RESPONSE, and remove LOG_ERROR from the
skill docs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 09:16:01 +01:00
Levi Neely 2d31b40037 Stop auto-archiving PROMPT_RESPONSE messages
Remove the inbox processing loop that auto-completed PROMPT_RESPONSE
messages, so they now stay in the user's inbox like all other types.
Update message.go grouping and SKILL.md docs accordingly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 09:15:10 +01:00
Levi Neely 060dbef65a Make bot prompt send_message instruction dynamic and compact
Replace hardcoded PROMPT_RESPONSE/subject/to values with dynamic
placeholders so bots derive the correct response type, recipient,
and subject from message context. Also restructure prompt assembly
order so the task instruction appears before the send_message
instruction (context → prompt → outInstruction).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 09:12:13 +01:00
Levi Neely 4b80a279f8 minor fix 2026-02-21 21:05:18 +01:00
Levi Neely 9d0e9b7e42 Add ollama backend support
- Add ollama backend implementation using mcphost and ollie
- Add ollama.yaml sandbox configuration
- Update README with ollama installation and usage instructions
- Add ollama command to Assist, anvilmcp, and anvilsrv
- Add ANVILLM_OLLAMA_MODEL environment variable
- Hardcode ollama-mcp.json config path to ~/.config/anvillm/ollama-mcp.json
2026-02-21 21:03:55 +01:00
Levi Neely 741aee8ddc Fix bead claim bug 2026-02-21 09:42:19 +01:00
Levi Neely c6987a7962 Remove deprecated audit endpoint
- Remove audit endpoint routes from 9P filesystem
- Delete audit handler functions (readAuditLog, GetAuditLog)
- Remove audit package and all audit logging code
- Remove audit log viewer from TUI (anvillm)
- Remove audit log streaming from web UI (anvilweb)
- Update documentation to reference events system instead
- All audit functionality replaced by events system
2026-02-20 22:18:53 +01:00
Levi Neely d5eac1d2c1 Move internal/beads/README.md to BEADS.md at project root 2026-02-20 22:11:45 +01:00
Levi Neely 4bc035181d Enhance Beads 9P API with comprehensive endpoints
- Document all existing API endpoints and properties
- Add agent/beads/stale endpoint for stale work detection
- Add agent/beads/children/{id} for hierarchical queries
- Add agent/beads/query endpoint for filtered queries with JSON
- Update documentation with comprehensive examples

Closes bd-5sk, bd-eg2.5.1.5
2026-02-20 22:07:17 +01:00
Levi Neely b4e68108e1 Expose remaining beads API endpoints
- Add agent/beads/batch/{ids} for bulk lookups
- Add agent/beads/label/{label} for label-based queries
- Add agent/beads/blocked for blocked issues
- Add agent/beads/{id}/dependencies-meta for dependency metadata
- Add agent/beads/{id}/dependents-meta for dependent metadata
- Add agent/beads/config for all configuration

Closes bd-eg2
2026-02-20 21:47:10 +01:00
Levi Neely 6a8bad003f remove beads thin wrapper, github-to-beads 2026-02-20 21:24:06 +01:00
Levi Neely 61bf3eab01 Fix bead assignee field on claim
- Pass sessionID from p9 server to BeadsFS.Write
- Use sessionID as actor in executeCtl instead of hardcoded 'system'
- Assignee now automatically set to claiming session ID
- Falls back to 'system' if no sessionID available
2026-02-20 19:14:30 +01:00
Levi Neely 34069ced99 Revert RevokeClaim functionality from beads and p9 interfaces 2026-02-20 19:07:45 +01:00
Levi Neely bf8c0d7cdb improve bead id special case "fire-forget" prompt 2026-02-20 19:05:06 +01:00
Levi Neely 9005c88a41 Add beads skill and improve beads implementation 2026-02-20 18:16:15 +01:00
Levi Neely 5854f95f9b Assist: Add Tasks window for beads task management
- Tasks window with sorted list, blocker count column, index for navigation
- View window with frontmatter (title, status, blockers), Put saves changes
- New window with blockers field for setting deps on create
- Hierarchical subtask IDs (bd-s2r.1) via parent-id parameter
- Blocks tag for quick dependency add via selection
- Remove tag for deleting beads via chord
- beads/ctl commands: new, update, delete, dep, undep
- beads/{id}/json includes blockers array
- Fixed parseQuotedArgs to preserve empty quoted strings
- Fixed escape sequence handling in descriptions
2026-02-20 10:13:53 +01:00
Levi Neely 536b358006 Sort session list by creation time (newest first)
Backend changes:
- Add CreatedAt() to Session interface
- Implement CreatedAt() in tmux.Session (field already existed)
- Sort Manager.List() by creation time descending

Benefits:
- Deterministic ordering (no more random map iteration)
- Newest sessions appear first (most useful)
- All clients benefit immediately
- head -1 now reliably gets most recent session

README:
- Update example to use head -1 for newest session
- Document that list is sorted newest first
2026-02-19 23:51:10 +01:00
Levi Neely 6a5c326a93 Tech editing pass on beads README
Logical flow improvements:
- Condense overview and merge storage backend inline
- Move commands table before examples (reference before use)
- Remove duplicate commands table
- Consolidate examples into single code block
- Merge initialization and integration sections
- Condense MCP section
- Merge benefits and implementation sections
- Consistent formatting (em dashes, bullets)

Result: Clearer flow, no redundancy, 40 lines removed
2026-02-19 23:38:06 +01:00
Levi Neely 6966c1b9ef Remove IDEAS.md link from beads README
IDEAS.md is ephemeral and changes frequently
2026-02-19 23:35:43 +01:00
Levi Neely 9ebd239a95 Add beads task tracking integration via 9P filesystem
- Add beads dependency (steveyegge/beads)
- Create internal/beads/beads.go: Storage wrapper for beads operations
- Create internal/p9/beads.go: 9P filesystem handlers for beads
- Integrate beads into 9P server (shared across all namespaces)
- Add beads directory to 9P filesystem: /agent/beads/
- Support commands: init, new, claim, complete, fail, dep
- Add ANVILLM_BEADS_PATH env var for custom beads location
- Update IDEAS.md with multi-tracker import design (Jira, GitHub, GitLab, Linear)
- Beads provides persistent, crash-resilient task tracking for multi-agent workflows
2026-02-19 23:08:50 +01:00
Levi Neely e1fc56f213 Improve event system: add initial state event and rename exited to killed
- Emit initial state change event (stopped -> starting) when session is created
- Rename 'exited' state to 'killed' for clarity
- Remove duplicate killed event emission (Close() already emits via transitionToLocked)
- Set OnStateChange callback in NewManager to emit state change events
- All state changes now properly emit events via callbacks
2026-02-19 20:29:43 +01:00
Levi Neely 65be761262 Fix event system: wire state changes to OnStateChange and fix /events 9p read
- Wire all state changes in tmux session to use transitionToLocked (triggers OnStateChange)
  - Close() exited state
  - Refresh() stopped states (intentional stop, restart spam prevention, auto-restart failure, PID=0)
- Add event callbacks to mailbox manager for send/receive events
  - Callbacks fire when message removed from outbox (send) and delivered to inbox (receive)
  - Consistent with state change callback pattern
- Fix /events 9p read handler to respect offset/count
  - Prevents infinite read loop by properly signaling EOF
  - Uses readFile() pattern like /list for consistency
2026-02-19 20:18:55 +01:00
Levi Neely 4c79fc796c Add 9P event queue infrastructure
- internal/events: new package with Queue supporting Push/Read/Ack and 2-min TTL
- internal/p9: expose /events file (read returns JSON lines, write accepts ack)
- internal/backend/tmux: add OnStateChange callback to Session
- internal/session: add OnStateChange callback to Manager

No events are emitted yet - infrastructure only.
2026-02-19 18:56:24 +01:00
Levi Neely d3f1d67547 Add Archive window, UUID-based message lookup, fix backend column in list 2026-02-19 16:39:43 +01:00
Levi Neely 97a0a66722 Reload sandbox config on Restart for hot-reload of YAML changes 2026-02-19 16:24:57 +01:00
Levi Neely 7089aa96fb Make inbox notification more action-oriented
- Change from 'check inbox' to 'You have a new message'
- Add 'respond appropriately' to emphasize action needed
2026-02-18 22:10:43 +01:00
Levi Neely 3515f51151 Replace all 9p command references with MCP tools
- Updated anvillm-communication skill to use MCP tools
- Changed session.go to instruct agents to use send_message
- Updated manager.go to tell agents to use read_inbox
- Updated Claude hook to mention read_inbox tool
- Cleaner, more consistent interface across all documentation
2026-02-18 21:49:35 +01:00
Levi Neely 75bfd529ca fix build errors 2026-02-18 20:20:58 +01:00
Levi Neely 5399d709c4 Replace PID-based temp files with AGENT_ID env var
- Simplified Claude hooks to use AGENT_ID instead of PID lookup
- Updated 9p-read-inbox to use AGENT_ID env var
- Removed temporary file creation in tmux.go
- Much cleaner and more reliable approach
2026-02-18 20:09:12 +01:00
Levi Neely af206f4304 Add agent system configuration and AGENT_ID support
- Add HOME/prj and HOME/src filesystem mounts to global config
- Add AGENT_ID environment variable support
- Add agent skills and mcpt configuration paths
- Add JENKINS_MCP_AUTH environment variable
- Implement AGENT_ID setup in tmux backend sessions
2026-02-18 16:23:30 +01:00
Levi Neely 937ad83e97 Remove deprecated endpoints and fix mailbox auto-completion
- Fix PROMPT_RESPONSE messages not auto-completing
- Remove deprecated message types (LogInfo, LogError, StatusUpdate)
- Remove entire chat log system (replaced by audit log)
- Migrate user prompts to mailbox system in main.go
- Remove {id}/in and {id}/out 9P endpoints
- Only mail processor uses sess.Send() directly
- Fix file index constants after removing in/out files
- Remove unused SendCtl function
2026-02-17 23:06:07 +01:00
Levi Neely b199fb23dc Remove Sandbox configuration window from Assist
- Remove Sandbox button from main window tag
- Remove Sandbox case handler and related functions
- Remove sandbox package import
- Delete internal/ui/sandbox.go

The Sandbox window is no longer needed as sandbox configuration
has been split into layered configuration (global, backends, roles, tools).
2026-02-17 22:18:02 +01:00
Levi Neely 67c3133ff8 dead letter 2026-02-17 22:14:55 +01:00
Levi Neely 314d347e76 Add centralized audit log system
- Created internal/audit package for centralized logging
- Replaced per-session log files with single agent/audit file
- Updated all UIs (TUI, web, Emacs) to use centralized audit log
- Modified mailbox manager to log all message deliveries with aliases
- Updated Alog script to stream centralized audit log
- Removed session-specific log streaming in favor of global audit log
2026-02-17 22:07:39 +01:00
Levi Neely 359258f8c5 improve messaging 2026-02-17 18:58:06 +01:00
Levi Neely ff2bd372c1 improve send message api 2026-02-17 18:20:01 +01:00
Levi Neely 53bf135d01 Add dynamic inbox refresh to anvilweb
- Inbox badge updates every 5 seconds automatically
- Messages view auto-refreshes every 5 seconds when inbox tab is visible
- Archive buttons trigger immediate inbox refresh
- Fixed backend to return empty array instead of null for empty inbox
- Added user/ctl endpoint for completing messages
2026-02-17 17:19:53 +01:00
Levi Neely 45356673ec Update mailbox message types and validation 2026-02-17 16:32:20 +01:00
Levi Neely e227aee097 Add persistent message types to communication system 2026-02-17 16:11:34 +01:00
Levi Neely b66e9822a2 Fix attach for new tmux session naming and clean up emacs prompts
Front-ends were constructing anvillm-{backend} but backend now uses
anvillm-{namespace}. Updated Assist and emacs to read tmux target from
the tmux file instead of constructing it from backend name.

Also removed broken direct prompt functionality from emacs (P and M-P
keybindings that used /in file directly).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-17 15:32:48 +01:00
Levi Neely 3f3b5e9f69 Test passed: messages received in order 2026-02-17 14:47:25 +01:00
Levi Neely fa127f1d44 Reduce idle window from 30 to 15 seconds before prompting agents 2026-02-17 14:40:21 +01:00
Levi Neely 35b3ff338e Fix 9p-read-inbox to strip .json extension when marking messages complete 2026-02-17 14:37:46 +01:00
Levi Neely 72ffd90bf3 Add Claude hooks integration for AnviLLM
- Created install-claude-hooks.sh to merge hooks into existing settings.json
- Updated mkfile to use merge script instead of overwriting settings.json
- Made agent name configurable via CLAUDE_AGENT_NAME env var
- Added Claude agent configuration and hook scripts
- Removed unused NewClaudeWithContinue/NewClaudeWithResume functions
2026-02-17 10:27:59 +01:00
Levi Neely 50f8cde2ee Remove reserved flag and fix state transitions
- Remove reserved flag and all reservation logic (unnecessary for kiro-cli)
- Fix session ID file creation: detect kiro-cli runs directly in pane
- Add retry loop for FindBackendPID with kiro-cli detection
- Update hooks to use PPID's parent (kiro-cli PID) instead of 15569
- Remove 5-second delay from running->idle transition
- Clean up workflow scripts: remove explicit skill references and communication protocol sections
- Update researcher roles to use knowledge base, web, and codebase
2026-02-16 23:07:35 +01:00
Levi Neely 7dc3e6f4b5 Add state machine verification and error recovery transitions
- Created STATE_MACHINE_VERIFICATION.md documenting all states and transitions
- Added error→idle transition for manual recovery from error state
- Added error→starting transition for restart from error state
- Verified all 21 transition call sites across codebase
2026-02-16 20:46:30 +01:00
Levi Neely 825ce1e415 Implement state machine improvements with reservation system and condition variables 2026-02-16 20:26:50 +01:00
Levi Neely d95b18dab4 Fix: Transition to idle for all outbox messages
Agents were getting stuck in 'running' state after sending messages
to user. Previously only peer messages triggered idle transition.

Now all outbox messages (user and peer) trigger transition to idle,
allowing agents to receive new messages and preventing stuck states.

Verified by comprehensive state machine simulation covering all
transitions, edge cases, concurrency, and session lifecycle.
2026-02-16 18:13:41 +01:00
Levi Neely 9d58f8a9fc fix(session): synchronous message delivery with proper retry handling
- Drain all outbox messages in batch instead of one per tick
- Process inbound messages synchronously to ensure delivery before completion
- Keep failed messages in inbox for retry instead of re-delivering
- Simplify control flow with early continue pattern
2026-02-16 17:12:44 +01:00
Levi Neely c1b3f525da anvilweb: fix attach button, improve UI
- Fix Attach button to launch foot terminal with tmux attach
- Add tmux file to 9P server to expose session:window target
- Replace action buttons with cleaner layout: main actions visible,
  secondary actions in dropdown menu
- Add browser notifications for session state changes
- Preserve open dropdown menu across table refresh
- Remove disabled state from Prompt button (mailbox queues prompts)
2026-02-16 16:41:58 +01:00
Levi Neely 0dd4980392 p9: auto-transition sender to idle on peer message
When an agent sends a message to another agent (not user),
automatically set sender state to idle. This ensures agents
can receive responses without needing explicit STATUS_UPDATE.
2026-02-16 16:01:58 +01:00
Levi Neely 9ff6262d62 Rename peer-bot skill to anvillm-communication
- Rename skill to reflect broader scope (agent-to-agent, agent-to-user)
- Add AnviLLM references to all workflow agent contexts
- Update README example to use mailbox pattern
- Fix heredoc delimiter conflict (EOF -> MSGEOF) in injected prompt
2026-02-16 15:35:46 +01:00
Levi Neely e95c9ad8cd Simplify idle transition via mailbox
Message to user now triggers idle state automatically.
Removed separate idle signal instruction from prompts.
Single action (send to user) replaces two-step process.
2026-02-16 15:11:39 +01:00
Levi Neely 7b950c4eef Add user mailbox for unified communication
- Add agent/user/ directory with inbox/outbox/completed
- User is first-class participant (not a session)
- Bot->user: bot writes to outbox with to="user"
- User->bot: user writes to user/outbox with to="{session-id}"
- User inbox messages written to sender's log file
2026-02-16 15:05:51 +01:00
Levi Neely e6766999dc fix: overly aggressive error state detection 2026-02-16 09:33:21 +01:00
Levi Neely 51679e5661 Implement mailbox system for bot-to-bot communication
- Add mailbox manager with inbox/outbox/completed structure
- Expose mailboxes via 9P filesystem (agent/{id}/inbox, outbox, completed)
- Mail processor runs every 5s to deliver messages from outbox to inbox
- Messages delivered when recipient is idle, formatted and sent via in file
- Retry logic: 3 attempts max, then discard with notification to sender
- Race condition fixes: messages moved to completed before sending
- Auto-generate message ID and timestamp if missing from bot's JSON
- Update peer-bot skill to use mailbox system with JSON format
- Update all workflows (DevReview, DevReviewQA, Planning) with:
  - Explicit shell command examples for sending messages
  - plan9 task for all agents
  - Mailbox instructions without markdown code blocks
- Fix idle signaling: bots must write summary to out BEFORE signaling idle
- All messages archived in completed/ with proper metadata
2026-02-15 21:16:00 +01:00
Levi Neely 873f839278 Implement layered sandbox configuration system
- Add global.yaml base config (renamed from sandbox.yaml)
- Add backend-specific configs (claude.yaml, kiro-cli.yaml)
- Add role configs (developer, reviewer, tester, architect, etc.)
- Add task configs (git, docker, go, rust, python, nodejs, etc.)
- Implement config merging: global + backend + role + tasks
- Update workflows to use roles and tasks
- Create tester role with read-only source, execute-only bins
- Fix reviewer role to use rox for bin directories
- Auto-create RW directories that don't exist
- Make backend configs required (fail if missing)
- Update mkfile to install cfg files to ~/.config/anvillm
- Remove Role-Based Sessions from IDEAS.md (now implemented)
2026-02-15 18:57:55 +01:00
Levi Neely 2c0196fbe9 Add idle state signaling and output summary support 2026-02-15 10:57:18 +01:00
Levi Neely a10a70bebd Fix deadlock in agent chat log and improve response tracking
- Add chat log support with new 'log' file (read) and 'out' file (write)
- Fix deadlock: create appendToChatLogLocked for callers holding mutex
- Improve prompts to request comprehensive summaries with actual response text
- Enforce 2MB chat log size limit with smart truncation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 10:20:32 +01:00
Levi Neely bef457a3aa Qualify tmux sessions per-namespace
- Extract namespace suffix (e.g., '0' from '/tmp/ns.user.:0/')
- Append suffix to tmux session names (e.g., 'anvillm-kiro-cli-0')
- Allows multiple namespace instances to coexist without conflicts
- Updated backend constructors to accept namespace suffix parameter
2026-02-14 18:35:35 +01:00
Levi Neely 452fc41ea5 basic self-healing 2026-02-14 17:51:28 +01:00
Levi Neely 4a79985bcf explicit signaling for process states 2026-02-14 14:33:57 +01:00
Levi Neely b7a823f120 feat: split monolith into anvilsrv daemon and Assist client
Major architectural refactoring to separate server and UI concerns:

Architecture Changes:
- Split into anvilsrv (server daemon) and Assist (Acme client)
- Removed UI coupling from server (OnAliasChange, WinID tracking)
- Server runs as background daemon, client reconnects as needed
- Client auto-starts server if not running

Server (anvilsrv):
- Add daemon management: start/stop/status commands
- Daemonize by default (fgstart for foreground/debug mode)
- Proper PID file handling in $NAMESPACE (not /tmp)
- Graceful shutdown with SIGTERM handling
- Duplicate start prevention with stale PID detection

Client (Assist):
- Auto-start anvilsrv if not running
- Fixed plan9 package imports (OWRITE/OREAD constants)
- Removed unused context import

Security Fixes:
- Move PID file from /tmp to $NAMESPACE (prevent symlink attacks)
- Add path validation in session creation:
  - Clean path traversal (/../../../etc → /etc)
  - Verify directory exists before creating session
  - Ensure absolute paths
  - Reject non-directory paths
- Add SECURITY.md documenting 9P socket risks

Service Integration:
- Add systemd service files (system, user, template)
- Add runit service files (run, finish)
- Add service documentation and installation instructions

Build & Testing:
- Both binaries build successfully
- All daemon operations verified (start/stop/status/daemonize)
- Path validation tested and working
- Auto-start functionality verified
- Add DevReviewQA workflow script

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-14 11:30:57 +01:00
Levi Neely c445b21206 fix: Stop now preserves tmux window by tracking backend PID
The Stop() method was destroying the tmux window because it killed the
bash shell (pane PID) instead of just the backend process. This commit
fixes the issue by:

1. Added FindBackendPID() to find the actual backend process (child of bash)
2. Modified session creation to store the backend PID, not the shell PID
3. Updated stopInternal() to kill only the backend process:
   - Send Ctrl+C (handles SIGINT)
   - Send second Ctrl+C if still alive (some CLIs need 2x)
   - Use SIGTERM/SIGKILL on backend PID if unresponsive
   - Never kill the bash shell, preserving the tmux window
4. Fixed Restart() to properly clean up and recreate FIFO

Tested successfully:
- Stop kills backend but preserves window ✓
- Session state transitions to "stopped" ✓
- Restart reuses same window and works ✓
- Can send prompts after restart ✓

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-14 10:28:06 +01:00
Levi Neely e25d1658dd feat: add Stop/Restart support and fix critical deadlock bug
Add Stop and Restart commands for session management, allowing graceful
termination and restart of backend processes. Add peer-bot skill for
agent-to-agent communication via 9P filesystem.

Critical fixes:
- Fix double-unlock deadlock in Stop() that would cause immediate panic
- Fix resource leak in Restart() where transitioning flag wasn't cleared on error paths
- Fix race conditions in reader() goroutine from multiple lock/unlock cycles
- Fix busy loop in reader() after EOF by using proper wait loop instead of polling FIFO

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-14 09:47:02 +01:00
Levi Neely 341436a6fd feat: add Refresh command to re-detect session state
- Expose via Acme tag bar and 9P ctl file
- No arg refreshes all sessions, with arg refreshes one
2026-02-13 15:05:11 +01:00
Levi Neely e28d39aab6 fix: improve kiro-cli state detection and add Refresh method
- IsBusy now checks /proc/PID/stat for process state (R/D = busy)
  when no child processes exist, fixing false idle detection
- Add Refresh() to Session interface to re-detect state on demand
2026-02-13 15:03:27 +01:00
Levi Neely f31ea21d5f Remove unused err file from 9P filesystem 2026-02-13 11:47:02 +01:00
Levi Neely 2df14ce071 fix bot-to-bot interaction in claude? 2026-02-13 07:54:06 +01:00
Levi Neely 483ada27d8 bugfix in ctl new, dev-reviewer flow create script 2026-02-12 19:41:51 +01:00
Levi Neely b20f6e95db remove dead/wasteful code 2026-02-12 18:45:29 +01:00
Levi Neely 255c939b2f non-blocking 9p in 2026-02-12 18:23:18 +01:00
Levi Neely fe56df8930 Replace quiescence detection with process tree inspection
Detect idle state by checking if kiro-cli-chat has tool children
rather than relying purely on output quiescence. Fixes premature
idle detection during long-running processes like remote builds.
2026-02-12 16:01:24 +01:00
Levi Neely 6e9a4c612e Add session context, summary, and bot-to-bot communication support
- Add context field to sessions (prepended to every prompt)
- Add summary field (first 100 chars of last response)
- Expose context/summary via 9p filesystem
- Add Alias and Context commands to acme UI
- Improve notify script to show cwd basename and summary
- Simplify Kill command to use session ID instead of PID
- Update list format to include alias column
- Add IDEAS.md notes on bot-to-bot communication
2026-02-12 14:59:35 +01:00
Levi Neely 213dededb4 Add grace time for shell initialization in tmux sessions 2026-02-12 09:04:47 +01:00
Levi Neely f104c6aa5e rethink save/load 2026-02-11 11:35:08 +01:00
Levi Neely 3f570e993e kiro fixes 2026-02-11 09:35:28 +01:00
Levi Neely 326c512976 env support for sandbox 2026-02-11 09:15:59 +01:00
Levi Neely 27530827d7 update docs, never disable sandbox 2026-02-11 08:48:06 +01:00
Levi Neely 528a482fe8 basic sandboxing support with landrun, fail fast 2026-02-11 08:32:14 +01:00
Levi Neely d8fcb8fc89 rm dead code 2026-02-10 22:33:30 +01:00
Levi Neely d76236b95b fix: user messages to stdout/stderr 2026-02-10 22:28:01 +01:00
Levi Neely 3ef93944a1 fix: load session in kiro 2026-02-10 22:20:31 +01:00
Levi Neely 460a6fd75f support multiple backends per Assist instance 2026-02-10 22:02:15 +01:00
Levi Neely 6cb61a7a32 debug mode, don't print to main window, rename go module and main window 2026-02-10 21:45:27 +01:00
Levi Neely 8b80aa0fa9 fix process status display 2026-02-10 21:28:27 +01:00
Levi Neely 20c6255b08 fix process manager 2026-02-10 21:18:15 +01:00
Levi Neely 9be10a14de switched kiro to use tmux instead of pty, probably still buggy 2026-02-10 20:36:25 +01:00
Levi Neely d33bede0f1 warn unsupported actions, attach to tmux from acme, etc. 2026-02-10 20:01:18 +01:00
Levi Neely e7059b94fb claude basic chat support implemented 2026-02-10 11:55:10 +01:00
Levi Neely 5cd8cbc28f refactor done; claude support wip 2026-02-09 21:26:11 +01:00
Levi Neely 7ca987e6eb refactor in progress 2026-02-09 19:45:42 +01:00
Levi Neely d8dccd94b3 initial commit 2026-02-09 17:57:42 +01:00