How abeyakilesh/optimus works
Purpose and entry points
This repository combines a Next.js landing surface with a local-first “kernel” for orchestrating autonomous work toward a pull request. The primary web entry point is app/page.tsx, composed under app/layout.tsx; CLI/kernel execution begins at kernel/cli.ts. Architecture decisions indicate bring-your-own-key inference and a hosted surface that does not host the execution kernel (docs/adr/0002-byok-not-hosted-inference.md, docs/adr/0005-vercel-hosts-the-surface-never-the-kernel.md).
Web surface
The app/ tree is a presentation-only Next.js application: global styling and document shell reside in app/globals.css and app/layout.tsx, while app/page.tsx assembles the landing experience. Landing sections are independently represented in components/landing/Hero.tsx, components/landing/Features.tsx, and components/landing/CTA.tsx. This boundary should remain separate from kernel execution and credentials.
Kernel orchestration
kernel/harness.ts is the likely top-level execution harness coordinating a mission/run. kernel/scheduler.ts controls work sequencing, while kernel/broker.ts mediates requests or dispatch among execution participants. Shared contracts belong in kernel/types.ts; event-based progress and observability flow through kernel/events.ts. Together these form the central control plane from CLI invocation to scheduled work and emitted lifecycle events.
Capability, permissions, and built-ins
kernel/builtin.ts defines built-in capabilities/adapters available to the kernel. kernel/permissions.ts is the policy boundary governing which capabilities or operations a run may perform. The local-first ports-and-adapters direction is explicit in docs/adr/0003-local-first-ports-and-adapters.md; external model providers should therefore be invoked through replaceable boundaries rather than embedded in web components or scheduler logic.
Durable outputs and recovery
kernel/artifacts.ts owns materialized run outputs, likely including files or evidence required to produce/review a PR. kernel/rollback.ts provides failure recovery or reversal semantics. The important flow is: scheduled work produces events and artifacts; permissions constrain actions; rollback restores a safe state when a stage fails or is rejected. These boundaries are central to trustworthy automated repository modification.
Rules and analysis inputs
Repository-specific static-analysis rules are maintained under rules/, including rules/typescript/security/ and rules/javascript/security/. They are inputs to security or quality stages rather than application runtime code. sgconfig.yml likely configures their scanner integration. This creates a policy/checking boundary between kernel-generated changes and repository acceptance requirements.
Runtime, infrastructure, and validation
The browser surface uses Next.js/React (next.config.ts, app/), while kernel code is TypeScript running through its CLI/runtime (kernel/cli.ts, tsconfig.json). Vercel is intended to host only the surface, not the kernel (docs/adr/0005-vercel-hosts-the-surface-never-the-kernel.md). CI separates build, unit, end-to-end, performance, security, and supply-chain checks through .github/workflows/_build.yml, .github/workflows/_e2e.yml, and .github/workflows/_static-security.yml. Kernel behavior is validated directly in tests/kernel/orchestration.test.ts and tests/kernel/acceptance.test.ts.
Main entry points: scheduler.ts Work scheduler · harness.ts Run harness · artifacts.ts Run artifacts · layout.tsx Document shell
Components 19
Hosted web surface
Presentation-only Next.js landing site.
- Document shell
app/layout.tsx - Landing page
app/page.tsx - Landing sections · Hero, features, and CTA compose the landing experience.
components/landing/Hero.tsx - Global styles
app/globals.css
Local execution kernel
CLI-driven control plane for autonomous repository work.
- Kernel CLI · Local entry point for a mission or run.
kernel/cli.ts - Run harness · Coordinates a mission from invocation through completion.
kernel/harness.ts - Work scheduler
kernel/scheduler.ts - Request broker · Mediates dispatch among execution participants.
kernel/broker.ts - Kernel contracts
kernel/types.ts - Lifecycle events · Progress and observability for runs.
kernel/events.ts - Permissions policy · Constrains capabilities and operations available to a run.
kernel/permissions.ts - Built-in capabilities · Replaceable local-first capability adapters, including provider access.
kernel/builtin.ts - Run artifacts · Materialized changes and evidence for review or PR creation.
kernel/artifacts.ts - Rollback · Restores a safe state after failure or rejection.
kernel/rollback.ts
Policy and delivery
Acceptance rules, deployment boundaries, and CI.
- Security rules · Repository acceptance inputs for generated changes.
- Scanner configuration
sgconfig.yml - Validation CI · Build, end-to-end, static security, performance, and supply-chain checks.
.github/workflows/_build.yml - Vercel deployment boundary · Hosts only the web surface, never the execution kernel.
docs/adr/0005-vercel-hosts-the-surface-never-the-kernel.md - BYOK inference policy · Inference credentials remain user-provided rather than hosted.
docs/adr/0002-byok-not-hosted-inference.md
Connections 20
- Document shell → Landing page: renders
- Document shell → Global styles: applies
- Landing page → Landing sections: assembles
- Vercel deployment boundary → Document shell: hosts
- Vercel deployment boundary → Kernel CLI: excludes
- Kernel CLI → Run harness: starts run
- Run harness → Work scheduler: coordinates
- Work scheduler → Request broker: dispatches work
- Request broker → Built-in capabilities: invokes
- Run harness → Kernel contracts: uses
- Work scheduler → Lifecycle events: emits
- Work scheduler → Run artifacts: produces
- Permissions policy → Built-in capabilities: authorizes
- Permissions policy → Work scheduler: constrains
- Run harness → Rollback: recovers via
- Rollback → Run artifacts: restores safe state
- Scanner configuration → Security rules: loads
- Security rules → Run artifacts: checks changes
- Validation CI → Run artifacts: validates
- BYOK inference policy → Built-in capabilities: governs provider access