How leeminjing/focus works
Focus is a local-first desktop agent built around human-governed context rather than repeated prompts. The user deploys a task, an agent runs in a Context, and Portfolio Patrol observes results and—within delegated authority—continues, curates, derives, merges, pauses, or stops work; the Kernel validates and commits decisions. Derived Context uses revision history to shape later execution, while the desktop exposes conversation, portfolio, and intervention controls. README documents the major workflow and capabilities; several subsystem links below are based on that documentation and the file tree, not sampled implementation.
Main entry points: focus Agent runtime · patrol.py Portfolio Patrol · agent_loop Agent Loop · routes.py Desktop API
Components 19
Desktop experience
- Focus desktop
desktop/app.js - Loop console
desktop/loop-console-controller.js
Agent execution
- Run orchestration
backend/app/desktop/run_orchestration - Agent Loop
backend/app/desktop/agent_loop - Agent runtime
backend/packages/harness/focus - Tools and skills
backend/packages/harness/focus/tools - Workspace coordination
backend/app/desktop/workspace_coordination - Spatial Patrol plugin
plugins/spatial-patrol
Context operations
- Context curation
backend/app/desktop/context_curation - Context expansion
backend/app/desktop/agent_loop/context_expansion - Context service
backend/app/desktop/context_service.py - Revision repository
backend/app/desktop/context_evolution/repository.py
Portfolio governance
- Portfolio Patrol
backend/app/desktop/agent_loop/patrol.py - Decision Kernel
backend/app/desktop/agent_loop/kernel.py
Runtime platform
- API gateway
backend/app/gateway/app.py - Desktop API
backend/app/desktop/routes.py - Chat models
backend/packages/harness/focus/models - Run persistence
backend/packages/harness/focus/persistence
Other components
- User
Connections 20
- User → Focus desktop: operates
- Focus desktop → API gateway: sends API requests
- API gateway → Desktop API: routes requests
- Focus desktop → Loop console: controls Loop
- Loop console → Desktop API: queries and intervenes
- Desktop API → Run orchestration: deploys Runs
- Run orchestration → Agent Loop: starts execution
- Agent Loop → Agent runtime: executes agent
- Agent runtime → Chat models: calls model
- Agent runtime → Tools and skills: invokes tools
- Agent Loop → Portfolio Patrol: reports results
- Portfolio Patrol → Decision Kernel: submits decision
- Decision Kernel → Agent Loop: commits control
- Portfolio Patrol → Context curation: curates contexts
- Portfolio Patrol → Context expansion: plans context work
- Context curation → Context service: publishes revisions
- Context service → Revision repository: reads and writes
- Agent runtime → Run persistence: stores checkpoints
- Run orchestration → Workspace coordination: coordinates workspace
- Desktop API → Spatial Patrol plugin: mounts plugin API