Commit Graph

228 Commits

Author SHA1 Message Date
ed58cc9a96 Merge pull request 'fix(kugetsu): use --format json for session existence check (#38)' (#39) from fix/issue-38-session-checking into main 2026-03-31 06:58:39 +02:00
shokollm
bfb8ee045b fix(kugetsu): use --format json for session existence check
Use opencode session list --format json with grep instead of table
output to make check_opencode_session_exists() more reliable.

This fixes issue #38 where forked sessions may not appear in the
table format output, causing false 'session expired' reports.
2026-03-31 04:56:55 +00:00
a3c24e53b9 Merge pull request 'Add parallel capacity test tool for Hermes/OpenCode' (#5) from fix/issue-3-parallel-test into main 2026-03-31 06:28:58 +02:00
shokollm
e2c9ef9ed1 docs: add capacity planning section to README 2026-03-31 04:02:03 +00:00
617702d229 Merge pull request 'docs #4: Document Hermes Communication Patterns' (#23) from docs/issue-4-hermes-communication-patterns into main 2026-03-31 05:50:55 +02:00
shokollm
5bc70dd515 feat(parallel-test): add kugetsu mode, memory limits, and cost tracking 2026-03-31 03:47:38 +00:00
shokollm
905e76e654 docs: use git.example.com as placeholder URL per review 2026-03-31 03:40:59 +00:00
shokollm
94de97ed64 docs: update README status to reflect Phase 3 implementation 2026-03-31 03:32:05 +00:00
shokollm
1092f73255 cleanup: remove unused .hermes/skills/agent-workflows 2026-03-31 03:31:07 +00:00
shokollm
cd16ce19c6 merge: resolve conflicts with main (psutil with fallback, use --dir flag) 2026-03-31 03:29:00 +00:00
shokollm
b22a7da710 security: redact exposed Gitea credentials in documentation 2026-03-31 03:25:34 +00:00
08e40e5396 Merge pull request 'feat(phase3): Full Phase 3 implementation - Chat Agent, PM Agent, and Integration' (#32) from feat/issue-19-phase3 into main 2026-03-31 04:55:21 +02:00
shokollm
9e1ff74330 test(kugetsu): add unit tests for status, delegate, doctor, notify commands
Added 10 new tests:
- kugetsu status (5 tests): uninitialized, base missing, pm-agent missing, Python None handling, session expired
- kugetsu delegate (2 tests): no message, pm-agent missing
- kugetsu doctor (1 test): basic command execution
- kugetsu notify (2 tests): list with no file, clear with no file

Total tests: 38 (all passing)
2026-03-31 02:52:31 +00:00
shokollm
93ebb55f57 refactor: remove obsolete kugetsu-helpers skill
kugetsu-helpers was a shim layer that is no longer needed since:
- kugetsu status replaces check-status
- kugetsu delegate replaces delegate-to-pm
- kugetsu doctor --fix replaces fix-permissions
- kugetsu list/start/continue cover remaining functions

All functionality is now in the kugetsu CLI directly.
2026-03-31 02:48:23 +00:00
shokollm
d35f006ed2 docs: replace git.fbrns.co with git.example.com in documentation
Sensitive URL replaced to prevent accidental exposure.
2026-03-31 02:46:42 +00:00
shokollm
bc40c4f500 refactor: restructure PM role under skills/kugetsu/pm/
### Changes:

1. **Moved kugetsu-pm to skills/kugetsu/pm/SKILL.md**
   - Simplified to 79 lines (under 100 line target)
   - kugetsu v3.0 with essential PM role definition
   - PM context injected at init/start/continue time

2. **Updated kugetsu_get_pm_context()**
   - Now reads from ~/.kugetsu/pm-agent.md (user custom) first
   - Falls back to skills/kugetsu/pm/SKILL.md (default)

3. **Updated kugetsu-chat v4.0**
   - Added notification checking on status/update queries
   - When user asks "status?", "any updates?", etc., check kugetsu notify list
   - Hybrid approach: PM includes notifications + kugetsu-chat checks on status

4. **Removed old skills/kugetsu-pm/SKILL.md**
   - Replaced by skills/kugetsu/pm/SKILL.md

### Structure:
skills/kugetsu/
├── SKILL.md
├── scripts/kugetsu
├── chat/           # future: kugetsu-chat could move here
│   ├── SKILL.md
│   └── SOUL.md
└── pm/
    └── SKILL.md    # PM role definition (v3.0)
2026-03-31 02:38:41 +00:00
shokollm
3d00ddbc1b feat(phase3): add notification system and kugetsu notify command
Phase 3c implementation - Notification System:

### New kugetsu commands:
- `kugetsu notify list` - Show unread notifications from PM Agent
- `kugetsu notify clear` - Mark notifications as read

### Notification system:
- PM Agent writes task events to ~/.kugetsu/notifications.json
- Events: task_complete, task_blocked, task_assigned
- Supports issue_ref and gitea_url for linking
- Hermes/Chat Agent reads notifications on user messages

### kugetsu-pm v2.0:
- Updated documentation with notification behavior
- PM Agent monitors Gitea for task completion
- Two review modes: PM reviews immediately OR asks dev if ready
- Notification triggers documented

### File renamed:
- phase3a-setup.md → kugetsu-chat-setup.md (more descriptive)

### Hermes gateway analysis:
- Gateway is a client (connects to Telegram), not a server
- Cannot push messages directly to Telegram from external process
- Notifications stored locally for Hermes to pick up on next user message
2026-03-31 02:19:50 +00:00
shokollm
b3171ed632 feat(kugetsu): add status, delegate, doctor commands; inject PM context at init
This commit implements Phase 3b/3c architectural improvements:

### New kugetsu CLI commands:
- `kugetsu status` - Check initialization status (replaces kugetsu-helper check-status)
- `kugetsu delegate <msg>` - Send message to PM agent (new command)
- `kugetsu doctor [--fix]` - Diagnose and fix kugetsu issues

### PM Context Injection:
- kugetsu init now reads ~/.kugetsu/pm-agent.md (if exists) and injects
  it into the PM agent session at creation time
- PM context is loaded ONCE at init, not on every delegation
- This improves efficiency - kugetsu-pm content read once, not 10 times

### kugetsu-chat updated:
- Now uses `kugetsu delegate` instead of kugetsu-helper
- Now uses `kugetsu status` instead of kugetsu-helper check-status
- Simplified - no longer depends on kugetsu-helpers

### kugetsu continue:
- Removed strict issue-ref format validation
- Now accepts any session name that is tracked in index.json["issues"]
- Issue-ref format is a guideline, not a hard requirement

### Documentation updated:
- phase3a-setup.md - Updated to reflect new kugetsu commands
- kugetsu-install.sh - Simplified Phase 3a setup instructions

### Breaking changes:
- kugetsu-helpers is no longer required for Phase 3a Chat Agent
- kugetsu-chat skill v3.0 now requires kugetsu CLI with new commands
2026-03-31 01:09:12 +00:00
shokollm
bc3cc8dd1e test(kugetsu-helpers): add unit test suite and fix None/null handling
- Add test suite at skills/kugetsu-helpers/tests/test-kugetsu-helpers.sh
- 11 unit tests covering check-status, delegate-to-pm, get-pm-session, etc.
- Fix bug: Python print(None) outputs literal "None" string, not empty
- All tests pass
2026-03-31 00:02:24 +00:00
shokollm
ef1179839d docs(phase3): update status and add testing plan 2026-03-30 23:00:34 +00:00
shokollm
6db33ea786 fix(phase3a): add fix-permissions command to kugetsu-helper
Add kugetsu_fix_pm_permissions function to fix opencode session permissions
for /tmp/kugetsu directory access. This resolves permission issues when
PM agent tries to access worktree directories.

Usage: kugetsu-helper fix-permissions
2026-03-30 15:52:29 +00:00
shokollm
a6bbd969b6 feat(phase3a): update SKILL.md and SOUL.md with stronger routing instructions
- SKILL.md: More explicit about MUST use this skill for delegation
- SOUL.md: Explicitly instruct to invoke /kugetsu-chat skill first
- Add more explicit delegation rules and error handling
2026-03-30 15:06:04 +00:00
shokollm
f8070246c8 feat(phase3a): add strong routing instructions to SOUL.md
- SOUL.md now explicitly instructs Hermes to ALWAYS use kugetsu-helper for delegation
- Clear delegation rules with examples
- Separation of casual conversation vs delegation

This is the first attempt at making Hermes route via kugetsu-helper automatically.
2026-03-30 14:56:31 +00:00
shokollm
2570a04cc6 docs #4: Document Hermes Communication Patterns
- Identify delegate_task() (max 3) vs terminal(opencode run) (no cap)
- Document Gitea as async communication hub
- PM ↔ Coding Agent communication protocols
- Practical examples for each pattern
- Issue state machine and known limitations
2026-03-30 14:38:16 +00:00
shokollm
227ec3a22e docs: add Phase 3a installation guide and update install script
- docs/phase3a-setup.md - Complete installation guide for Phase 3a
- skills/kugetsu/scripts/kugetsu-install.sh - Updated to reflect v2.2 changes
2026-03-30 14:25:22 +00:00
shokollm
7c94a59bb6 fix(phase3a): separate SOUL.md personality from SKILL.md routing
- SOUL.md: only personality/voice guidance (no routing logic)
- SKILL.md: definitive routing behavior + delegation process
- Add context passing via temp file for long tasks
- Add error handling table with user-friendly messages

This aligns with Hermes docs: SOUL.md = identity, SKILL.md = behavior
2026-03-30 14:20:21 +00:00
shokollm
60181afe6a feat(phase3a): initial Chat Agent infrastructure
Phase 3a implementation - Hermes Chat Agent configuration:

- kugetsu-chat/SOUL.md - Chat Agent persona and routing logic
- kugetsu-chat/SKILL.md - Chat Agent skill documentation
- kugetsu-chat/scripts/setup - Configuration setup script
- kugetsu-pm/SKILL.md - PM Agent skill documentation
- kugetsu-helpers/SKILL.md - Helper tools for Hermes-kugetsu integration
- kugetsu-helpers/scripts/kugetsu-helpers - Shell functions for delegation

Provides:
- Intent classification (small talk, task, status, mode change)
- PM Agent delegation via terminal()
- kugetsu status checking
- Session management helpers
2026-03-30 14:07:43 +00:00
cf18c1db04 Merge pull request 'feat(kugetsu): add git worktree isolation per session' (#22) from feat/issue-19-worktree-per-session into main 2026-03-30 15:58:41 +02:00
shokollm
3e12809095 fix(kugetsu): fix worktree name dash inconsistency and add worktree tests
- Fix issue_ref_to_worktree_name: use single dash for # like filename does
- Add tests for: pm-agent in index, destroy --pm-agent, worktree_path in session
- Add tests for: prune detects/removes orphaned worktrees, destroy removes worktree
- Add tests for: session file v2.2 format with worktree_path

All 28 tests pass.
2026-03-30 13:52:28 +00:00
shokollm
cf809688cf feat(kugetsu): add git worktree isolation per session
- Each issue session gets isolated git worktree to prevent workspace conflicts
- Worktree created on 'kugetsu start', removed on 'kugetsu destroy'
- Worktree path: ~/.kugetsu/worktrees/{sanitized-issue-ref}/
- Branch naming: fix/issue-{number} or fix/{identifier}
- Worktree always recreated on start (guaranteed clean state)
- 'kugetsu list' now shows worktree path
- 'kugetsu prune' also cleans orphaned worktrees
- 'kugetsu continue' runs opencode with --workdir pointing to worktree
- Update SKILL.md to v2.2 with worktree documentation

Part of issue #19 Phase 3 implementation
2026-03-30 13:45:10 +00:00
shokollm
12ad4eb3b7 feat(kugetsu): auto-create pm-agent session during init
- kugetsu init now creates both base and pm-agent sessions
- kugetsu start checks for pm-agent existence, errors if missing
- Add kugetsu destroy --pm-agent command
- Update list to show pm-agent session
- Update prune to preserve pm-agent.json
- Update SKILL.md documentation to v2.1

Part of issue #19 Phase 3 implementation
2026-03-30 13:10:47 +00:00
shokollm
202d8ccfbb docs: add Phase 3 chat architecture and overview documentation
- Add docs/kugetsu-chat.md:
  - Model B architecture (separate Chat/PM agents)
  - Session types (chat-agent, pm-agent, pm-agent-{repo}, issue sessions)
  - Hybrid message routing
  - PM Agent modes (notify/silent)
  - Context management (local + Gitea fetch on-demand)
  - Example flows

- Add docs/kugetsu.md:
  - Overview of kugetsu system
  - Quick start guide
  - Links to all documentation

- Update docs/kugetsu-architecture.md:
  - Add Phase 3 architecture section
  - Update success criteria
  - Add Phase 3 design decisions

- Add docs/telegram-setup.md:
  - BotFather bot creation guide
  - Security notes

- Remove ssh-keygen.sh (not needed)
2026-03-30 11:46:12 +00:00
4606c59ce8 Merge pull request 'feat(issue-17): add Tailscale VPN setup for container remote access' (#21) from feat/issue-17-tailscale-setup into main 2026-03-30 08:29:57 +02:00
shokollm
c2dbb6fa8f fix(tailscale-setup): use manual repo file for Fedora due to GPG key 404
The Tailscale GPG key URL returns 404 on some systems. Creating
the repo file manually with gpgcheck=0 as a workaround.
2026-03-30 06:21:40 +00:00
shokollm
1b5cd56e66 feat(issue-17): add Tailscale VPN setup script and documentation
- Add tailscale-setup.sh:
  - Multi-distro support (Debian/Ubuntu, Fedora)
  - Automatic OS detection
  - Systemd integration for tailscaled daemon
  - User choice: AUTHKEY or headless browser login
  - Configurable device name (defaults to hostname)
  - Verification steps after setup

- Update SKILL.md:
  - Add Tailscale VPN section under Remote Access
  - Document benefits and setup commands
  - Link to full documentation

- Update docs/kugetsu-setup.md:
  - Add Tailscale section before Security Notes
  - Compare Tailscale vs port forwarding
  - Document authentication methods
  - Add post-setup usage examples
  - Include uninstall instructions
2026-03-30 05:14:17 +00:00
3650447f9c Merge pull request 'feat(issue-11): add SSH setup script and remote access documentation' (#16) from feat/issue-11-ssh-setup into main 2026-03-30 07:03:32 +02:00
shokollm
3c92a12f28 feat(sshd-setup): multi-distro support and verification steps
- sshd-setup.sh: Auto-detect OS (Debian/Ubuntu/Fedora/RHEL/CentOS)
- Use appropriate package manager (apt-get vs dnf)
- Add verification steps after each major phase
- Exit with error if sshd installation fails
- Exit with error if sshd doesn't start successfully
- Add troubleshooting section in output

- kugetsu-install.sh: Add verification that kugetsu binary exists

- kugetsu-setup.md: Document multi-distro installation commands
2026-03-30 04:27:23 +00:00
shokollm
4da4d46bd1 docs(kugetsu-setup): simplify - remove Docker section and curl downloads
- Remove Docker/Podman section (not tested by maintainer)
- Remove curl download instructions (assume user cloned repo)
- Add note that Incus systemd config may vary by version
- Update troubleshooting to reflect cloned repo path
2026-03-30 04:03:00 +00:00
shokollm
0563e7bced docs: add chmod +x instruction before executing scripts
Users should explicitly grant execute permission to downloaded scripts
for transparency and security best practices.
2026-03-30 03:42:53 +00:00
shokollm
1e2d88d811 docs(kugetsu): add SSH remote access section to SKILL.md
- Add 'Remote Access via SSH (Optional)' section
- Documents automated sshd-setup.sh usage
- Explains what the setup does
- Shows remote usage examples
- Links to full docs/kugetsu-setup.md for host-side configuration
2026-03-30 03:42:13 +00:00
shokollm
7fb9b9c581 feat(issue-11): add SSH setup script and kugetsu-setup documentation
- Add sshd-setup.sh: automated SSH setup inside container
  - Checks for systemd prerequisite
  - Creates non-root user (configurable via argument, fallback to 'kugetsu')
  - Configures sshd for key-only authentication
  - Configures passwordless sudo for the user
  - Enables and starts sshd via systemd
- Add docs/kugetsu-setup.md: unified setup documentation
  - Container setup (Incus, Docker)
  - SSH setup (automated + manual steps)
  - Host-side port forwarding (Incus, firewall)
  - kugetsu installation
  - Usage guide
  - Remote access via SSH
2026-03-30 03:37:07 +00:00
3e0144ea7c Merge pull request 'feat(kugetsu): implement issue-driven session management' (#15) from feat/issue-14-session-management into main 2026-03-30 05:13:10 +02:00
shokollm
b422b33aa6 fix(kugetsu): use before/after session list to detect forked session
Compare session list before and after fork to reliably detect which
session is the newly created one. Avoids relying on parsing output
that may not contain session ID.
2026-03-29 20:25:41 +00:00
shokollm
636a41f41b fix(kugetsu): create session file before opencode fork
Create placeholder session file and add to index BEFORE running
opencode. This ensures we have a record even if opencode takes
long time or times out. Update with real session ID after fork.
2026-03-29 20:19:38 +00:00
shokollm
c51a886aa6 fix(kugetsu): capture forked session ID from opencode output
The --fork flag outputs the new session ID. Parse that instead of
relying on session list which may return wrong session when multiple
exist. Added fallback to session list parsing.
2026-03-29 20:16:51 +00:00
shokollm
7f3952ff9d test(kugetsu): add v2.0 test suite for issue-driven session management 2026-03-29 20:01:16 +00:00
shokollm
f2ab637d1f fix(kugetsu): update install script with new commands 2026-03-29 20:00:17 +00:00
shokollm
e014d7bfb9 fix(kugetsu): fix bash substitution error in cmd_start
The function call inside ${} syntax was invalid. Changed to use
command substitution $(...) instead.
2026-03-29 19:53:42 +00:00
shokollm
7146e3bd92 feat(kugetsu): implement issue-driven session management
- Add kugetsu init to create base session via TUI
- Add kugetsu start/continue for issue-based task handling
- Add kugetsu list/prune/destroy for session lifecycle
- Implement directory files + index.json storage pattern
- Use issue ref format: instance/user/repo#number
- Fork from base session enables headless operation

Solves: opencode headless CLI limitation discovered in issue #14
2026-03-29 19:51:51 +00:00
542f1e27c1 Merge pull request 'feat(kugetsu): add --debug flag for real-time output capture' (#13) from feat/kugetsu-debug-flag into main 2026-03-29 18:26:54 +02:00