Commit Graph

99 Commits

Author SHA1 Message Date
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