Commit Graph

56 Commits

Author SHA1 Message Date
Levi Neely 29fe71d24d Remove anvilmcp from mkfile 2026-03-20 15:19:44 +01:00
Levi Neely daf50d9783 beads: natural sort for hierarchical IDs
Sort bd-1.2 before bd-1.10 instead of lexicographic order.
2026-03-20 14:28:19 +01:00
Levi Neely c5e95eb1ea Remove cmd/anvilweb, cmd/anvilwebgw, cmd/anvillm, and elisp/
Drop legacy frontend proof-of-concepts (TUI, web UI, HTTP gateway,
Emacs major mode) to focus on the core. Assist remains as the primary
frontend; any 9P-speaking program can serve as a frontend.

Update README, mkfile, .gitignore, and architecture/client-interactions
diagrams accordingly.
2026-03-18 23:20:54 +01:00
Levi Neely 8ddb7f28b9 cron: fix NAMESPACE path to /tmp/ns.$USER.$DISPLAY; add PLAN9 export
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 15:38:06 +01:00
Levi Neely 6b49d69a4c cron: inline env setup in crontab command; drop variable assignments
Classic cron does not support variable assignments in the crontab.
Inline PLAN9, PATH, DISPLAY, and NAMESPACE exports directly in the
cron command, expanded at install time from the user's environment.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 15:27:05 +01:00
Levi Neely 96fe19fe02 cron-install: use $HOME/plan9 for PLAN9 instead of unbound $PLAN9
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 15:14:42 +01:00
Levi Neely e825611aec cron-install: set PLAN9 and PATH in crontab for anvillm-supervisor
Cron runs with a minimal environment; without PLAN9 and the full PATH,
9p cannot locate the namespace socket and sessions are not detected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 15:11:49 +01:00
Levi Neely 8814586a2c supervisor: replace Go supervisor with anvillm-supervisor shell script
Remove internal/supervisor Go package. Replace with anvillm-supervisor
script driven by cron: --orphans (every 5m) recovers in_progress beads
whose assignee session has died, --nudge (every 1m) prompts idle worker-
role bots to check for available work via execute_code + wait_for_bead.sh.
Nudges sent as user via send_message.sh. cron-install uses a temp file
to avoid pipeline issues.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 14:57:39 +01:00
Levi Neely 47a97e5cea supervisor: replace Go package with anvillm-supervisor shell script
Remove the internal/supervisor Go package and cron-driven orphan check
script. Replace with a single anvillm-supervisor script invoked by cron
that handles both orphan bead recovery (--orphans, every 5m) and idle
worker nudging (--nudge, every 1m). Nudges use send_message.sh as user,
consistent with existing mail processing. anvilsrv no longer runs any
supervisor goroutine.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 14:47:56 +01:00
Levi Neely 21b410f84e anvillm: add orphan bead recovery via cron
scripts/anvillm-orphan-check: scans all mounted beads projects every
5 minutes, finds in_progress beads whose assignee session has died,
and spawns a replacement agent with a bootstrap_session.sh prompt.

mkfile: install anvillm-orphan-check to $HOME/bin; add cron-install
and cron-remove targets for idempotent crontab management.

Default backend for replacement agents is $ANVILLM_DEFAULT_BACKEND
(falls back to "claude").

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-14 15:16:40 +01:00
Levi Neely 824ab88fe3 anvilmcp: handle args passed as JSON-encoded string; fix team-templates install path
- Parse args as JSON string fallback when LLM passes args incorrectly
- Update SKILLS_PROMPT and agent docs to use unquoted args syntax
- Install team-templates under $INSTALL_PATH/Teams instead of hardcoded $HOME/bin/Teams

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-07 17:40:35 +01:00
Levi Neely 715a1f7432 team-templates: add workflow team scripts using anvilspawn 2026-03-07 12:37:48 +01:00
Levi Neely a73ef83d3d roles: replace bot-templates with anvilspawn and structured roles
- Remove bot-templates/ entirely
- Add scripts/anvilspawn: spawn a bot by role+workdir, hash-prefixed alias
  ties bots to the same workdir for organic collaboration
- Add roles: solo-developer, developer, reviewer, tester, devops, author,
  technical-editor, researcher, taskmgr
- Standardize all roles to: Responsibilities / Prohibited Activities /
  Workflow / Response Format
- Remove explicit delegation protocols from all roles; delegation is emergent
- Remove inbox-check startup steps; messages are delivered automatically
- Update mkfile to install anvilspawn

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 20:49:30 +01:00
Levi Neely 6475b9f216 Add maildir messaging support for agent communication 2026-03-05 14:33:47 +01:00
Levi Neely 090b92bb0a fixes for mkfile and anvillm-notify 2026-03-02 17:10:47 +01:00
Levi Neely 75940dd963 feat: Conductor orchestration with intelligent time estimation
- Rewrote Conductor context prompt: cycle detection, single-domain
  validation, topological worker scheduling, deadline monitoring,
  completion logging, and replacement spawning on failure/timeout
- Add estimate_time.sh: computes LLM task deadline from bead signals
  (domain, child count, description length) using fitted model or
  cold-start defaults per domain
- Add calibrate_time_estimate.sh: updates model.json from completion
  data; auto-promotes 'other' labels to taxonomy when threshold met
- Add cfg/estimation/taxonomy.json: default 10-category domain taxonomy
- mkfile: create ~/.config/anvillm/estimation and ~/.local/share/anvillm/estimation at install time

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 16:43:01 +01:00
Levi Neely 4d51216fa6 Move SKILLS_PROMPT to root and refactor agent protocol
- Move SKILLS_PROMPT.md from kiro-cli/ to repo root (shared across backends)
- Replace verbose agent instructions with concise discovery protocol
- Enforce execute_code for all AnviLLM tool usage; forbid raw 9p commands
- Add agentspawn hook for claude backend
- Clean up install-mcp.sh tool list (now auto-discovered)
- Clarify SKILL.md wording for beads and anvillm-communication

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 21:50:48 +01:00
Levi Neely afe13afba2 Fix 9p tool access in execute_code sandbox
- Add DISPLAY, WAYLAND_DISPLAY, USER to landrun env passthrough
- Mount /etc/passwd read-only for getuser() to work
- Update mcptools scripts to check /etc/shadow instead of /etc/passwd for sandbox detection
2026-02-28 20:49:42 +01:00
Levi Neely 631c9fb47e Fix race conditions and path traversal bugs in internal/p9
- Fix race in open(): hold lock during fid modification
- Fix race in write(): copy path before unlock
- Fix race in remove(): read sessionID under lock
- Fix panic in walk(): guard empty qids slice
- Fix sessionID tracking: always update to current session
- Fix path traversal in skills.go: use filepath.Clean + bounds check
- Fix path traversal in tools.go: use filepath.Clean + separator check
- Fix repeated array access in beads.go: extract beadID variable
2026-02-26 22:40:56 +01:00
Levi Neely c10a008f3d install mcptools and skills to default dir 2026-02-26 20:21:31 +01:00
Levi Neely 8b87e3514a Move tool scripts from cmd/anvilmcp to mcptools/ 2026-02-26 14:36:50 +01:00
Levi Neely 5f8c41b576
Implement MCP code execution pattern (#20)
* Implement MCP code execution pattern

- Add execute_code tool for bash execution in landrun sandbox
- Remove redundant MCP tools (read_inbox, send_message, etc.)
- Implement dynamic tool discovery from ~/.config/anvillm/mcptools/
- Add workspace isolation (~/.cache/anvillm/exec)
- Add security: output limits, concurrency limits, validation, path traversal protection
- Update bot templates (Conductor, Taskmaster) with bash examples
- Update anvillm-communication skill to use execute_code pattern
- Create comprehensive documentation (user guide, migration guide, security guide)
- Add test suite for validation and limitedWriter
- Fix landrun flags: --rox for executables, --env for AGENT_ID passthrough
- Network blocked by default (no --connect-tcp or --unrestricted-network)

Token reduction: 80-99% via progressive tool discovery and subprocess data processing

* Fix code review issues in MCP code execution pattern

- Security: Change security.jsonl permissions from 0644 to 0600
- Bug: Fix limitedWriter to return correct byte count for io.Copy
- Bug: Fix tool schema inconsistency (execute_code requires only 'code')
- Performance: Move whitespace regex to package-level var
- Security: Improve validateCode with regex patterns and normalization
- Cleanup: Remove dead code from main.go and tools.go
- Cleanup: Rewrite shell scripts to use jq for safe JSON construction
- Docs: Fix duplicate sections and JavaScript syntax in bash examples

* Improve code validation security patterns

- Fix rm -rf bypass: allow optional whitespace before /
- Expand rm -rf to block sensitive paths (/home, /var, /usr, etc.)
- Block all network protocols in curl/wget (not just http/https)
- Add test for regex pattern compilation
- Add test cases for tabs, sensitive paths, ftp/file protocols

* Harden shell scripts and improve rate limiting

---------

Co-authored-by: Levi Neely <lkn@darkstar.example.net>
Co-authored-by: Levi Neely <lneely@pascom.net>
2026-02-26 14:02:54 +01:00
Levi Neely 6b2d7dc853 hotfix: claude mcp install 2026-02-24 13:00:37 +01:00
Levi Neely 2e1c2d8849 hotfix: claude in sandbox 2026-02-24 12:50:05 +01:00
Levi Neely 98a659e411 hotfix: mkfile 2026-02-23 22:03:12 +01:00
Levi Neely 8dae78f161 Merge remote-tracking branch 'origin/main' into conductor 2026-02-22 10:46:48 +01:00
Levi Neely 8ecbbbd678 Add bot templates and orchestration system
- Add bot-templates/ directory with specialized agent templates
- Update README.md with orchestration documentation
- Update mkfile with new build targets
- Remove old workflow files (DevReview, DevReviewQA, Docs, Planning, Research, Taskmaster)
2026-02-22 10:45:03 +01:00
Levi Neely a28cf13cae Add anvilwebgw HTTP gateway service, simplify anvilweb
- New cmd/anvilwebgw: standalone HTTP gateway daemon with start/stop/fgstart/status
  subcommands, exposing all 9P-connected API endpoints on :8081
- cmd/anvilweb simplified to a plain static file server that reverse-proxies
  /api/* to anvilwebgw; removes all 9P connectivity
- Frontend error handling overhauled: replace alert() with styled dismissible
  error banner and inline container errors showing actual server response detail
- Fix CSS specificity bug that kept error banner always visible
- Fix nil slice JSON encoding (null vs []) for empty inbox/archive responses
- mkfile: add anvilwebgw build and clean targets

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 09:01:23 +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 977745d133 Make skills command conditional: use agent-prompt/agent-skills if available 2026-02-19 15:30:56 +01:00
Levi Neely 5fdcc039d1 Add agent-hook script and SKILLS_PROMPT.md
- Added agent-hook for future use with wrapper script
- Created SKILLS_PROMPT.md for automatic skill loading
- Updated mkfile to install both
- Kept explicit commands in agent config (agent-hook needs wrapper)
2026-02-18 22:33:09 +01:00
Levi Neely e5b77b0d27 Revert "Remove 9p-read-inbox from mkfile"
This reverts commit c7c02c9502.
2026-02-18 22:18:29 +01:00
Levi Neely c7c02c9502 Remove 9p-read-inbox from mkfile 2026-02-18 22:17:48 +01:00
Levi Neely 191d00099f update mkfile 2026-02-18 21:45:40 +01:00
Levi Neely 8118f0c7b6 Add kiro-cli MCP installation to mkfile
- Run install-mcp.sh during build to configure MCP server
2026-02-18 20:21:54 +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 35b3ff338e Fix 9p-read-inbox to strip .json extension when marking messages complete 2026-02-17 14:37:46 +01:00
Levi Neely fed6bbdbdb Reorganize config structure: separate claude/ and kiro-cli/ directories 2026-02-17 10:35:31 +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 4ec64e9124 Rename skills script to anvillm-skills
- Fixed script to search for SKILL.md files in subdirectories
- Renamed scripts/skills to scripts/anvillm-skills for clarity
- Updated mkfile to install as anvillm-skills
2026-02-16 18:06:12 +01:00
Levi Neely 9936792d6b updates to workflows and roles 2026-02-16 08:48:04 +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 851ac311b0 remove acme log window in favor of external script 2026-02-15 13:22:12 +01:00
Levi Neely 38f3a8e765 Add web interface (anvilweb)
- Minimal Go web server with REST API for session management
- Single-page UI using Pico CSS (12KB, classless framework)
- Features: create sessions, send prompts, edit context/alias, control sessions
- Security: input validation, XSS prevention, path validation
- Auto-refresh every 5 seconds
- Documented security model (no authentication, localhost/SSH tunneling recommended)
2026-02-14 17:02:43 +01:00
Levi Neely c367b05a2e remove autostart notification daemon; rely on prompting for this 2026-02-14 14:35:57 +01:00
Levi Neely 4a79985bcf explicit signaling for process states 2026-02-14 14:33:57 +01:00
Levi Neely e7b1b1912a basic emacs interface 2026-02-14 12:23:27 +01:00
Levi Neely 14e3c8d9a4 feat: add curses-based TUI (anvillm)
Add terminal UI as an alternative to the Acme interface. Both UIs
interact with anvilsrv via the same 9P filesystem interface.

Implementation:
- cmd/anvillm/main.go: Full-featured TUI using tview/tcell
- Session list with color-coded states
- Keyboard-driven interface (no mouse required)
- Auto-refresh every 2 seconds
- Modal dialogs for creating sessions, sending prompts, setting aliases

Features:
- Create Kiro/Claude sessions (k/c keys)
- Send prompts to selected session (p key)
- Stop/Restart/Kill sessions (s/R/K keys)
- Set session aliases (a key)
- Refresh session list (r key)
- Help dialog (? key)
- Quit (q key)

UI Components:
- Session table with columns: ID, Alias, Backend, State, PID, Cwd
- Status bar showing keyboard shortcuts
- Modal forms for user input
- Color-coded session states (green=running, aqua=idle, etc.)

Dependencies:
- github.com/rivo/tview: TUI framework
- github.com/gdamore/tcell/v2: Terminal cell library

Build:
- Updated mkfile to build anvillm binary
- Fixed .gitignore to allow cmd/anvillm/ directory

Documentation:
- Added Terminal UI section to README
- Lists all keyboard shortcuts
- Notes that TUI uses same 9P interface as Assist

This provides a lightweight alternative for users without Acme.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-14 12:01:02 +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