Skip to content

feat(harness): Complete Agentic Harness Implementation (Phases 1-6)#92

Merged
epuerta9 merged 5 commits into
mainfrom
feature/agentic-harness
Jan 26, 2026
Merged

feat(harness): Complete Agentic Harness Implementation (Phases 1-6)#92
epuerta9 merged 5 commits into
mainfrom
feature/agentic-harness

Conversation

@epuerta9
Copy link
Copy Markdown
Collaborator

Summary

This PR implements the complete Agentic Harness system for Station, enabling long-running AI agent execution with:

  • Phase 1-2: Core executor with context compaction, doom loop detection, workspace isolation
  • Phase 3: Sandbox isolation (Docker/E2B/Host backends) with file operation tools
  • Phase 4: Session management with locking and metadata tracking
  • Phase 5: Message history persistence (JSON-based HistoryStore)
  • Phase 6: Interactive REPL with session persistence integration

Key Features

  • pkg/harness/ - Complete harness execution engine
  • pkg/harness/session/ - Session management with history persistence
  • pkg/harness/sandbox/ - Docker, E2B, and host sandbox backends
  • pkg/harness/tools/ - Bash, Read, Write, Edit, Glob, Grep tools
  • cmd/main/harness_repl.go - Interactive REPL with /history, /clear, /status commands
  • cmd/main/session_commands.go - Session management CLI commands

Test Plan

  • Run unit tests: go test ./pkg/harness/... -v
  • Run session tests: go test ./pkg/harness/session/... -v
  • Test REPL: stn harness --help
  • Test session commands: stn session --help

Notes

This branch has diverged from main and may require manual conflict resolution during merge.

🤖 Generated with Claude Code

- Add ExecutionContext with SessionID, WorkflowRunID, AgentRunID
- Add ResolveWorkspacePath() for workspace isolation
- Add git/cloner.go for runtime repo cloning
- Add collaboration modes (sequential vs parallel)
- Update PRD with design decisions:
  - Sequential mode: agents pick up where previous left off (same branch)
  - Parallel mode: each agent gets own branch, merge later
  - Session locking for sequential concurrent access
  - Explicit session lifecycle management
- Add session CLI commands (list, info, delete, cleanup, unlock)
- Integrate streaming into AgenticExecutor with full ownership identifiers
- Add StreamingConfig and wire publishers through execution engine
- Add session manager for workspace persistence and locking
- Add stream publisher tests and NATS publisher implementation

Phase 2 complete:
- 2.1 Workspace Isolation ✅
- 2.2 Session Manager ✅
- 2.3 Git Cloner ✅
- 2.4 NATS State Store ✅
- 2.5 Session CLI Commands ✅
- 2.6 Streaming Integration ✅
…mplete

Phase 2 complete:
- Session manager with locking
- Real-time streaming with ownership identifiers
- Session CLI commands (list, info, delete, cleanup, unlock)
- Git cloner for repo targeting

Phase 3 planned:
- Sandbox isolation strategies (Docker, Firecracker, gVisor, WASM)
- Resource limits (CPU, memory, disk)
- Network filtering
- Filesystem ACLs
- Add Sandbox interface with Create, Exec, ReadFile, WriteFile, etc.
- Add SandboxConfig with Mode, Resources, Network, Filesystem settings
- Implement HostSandbox (passthrough, no isolation)
- Implement DockerSandbox with container isolation:
  - Resource limits (CPU, memory, PIDs)
  - Network isolation (--network none by default)
  - Read-only root filesystem
  - Dropped capabilities
  - Security options (no-new-privileges)
- Add Factory for creating sandbox instances by mode
- Add comprehensive tests for HostSandbox

Supported modes: host, docker (firecracker, gvisor, wasm planned)
Phase 4 - Session Management:
- pkg/harness/session/session_executor.go - SessionExecutor with lifecycle mgmt
- pkg/harness/session/history_store.go - JSON persistence for message history
- Session locking, metadata tracking, and resume capability

Phase 5 - Session Persistence:
- WithInitialHistory executor option for loading prior conversation
- Automatic message persistence after each execution
- Session resume via --session <id> flag

Phase 6 - Interactive REPL:
- cmd/main/harness_repl.go - Full REPL with session persistence integration
- Commands: /help, /status, /history, /clear, /skills, /memory, /tools, etc.
- JSON export/import of session state
- Integration with HistoryStore for message persistence across sessions

Also includes:
- Sandbox isolation improvements (docker cp for file operations)
- Compaction with token counting and history truncation
- Tool registry with sandbox-aware execution
- E2E tests for multi-step execution and workflow simulation
- Documentation updates for testing operations
@epuerta9 epuerta9 force-pushed the feature/agentic-harness branch from 2ee1054 to 272b474 Compare January 26, 2026 23:30
@epuerta9 epuerta9 merged commit b74dcf5 into main Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant