theam / theam/facility

[0.12] Run Claude Code and Codex from agent manifests

Open
#277 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority:normal type:feature
Dominant language
TypeScript
Stars
71
Forks
64
Avg merge
15h 38m
Merged PRs (30d)
66

Description

Goal

Run Claude Code and Codex inside the persistent workspace using the engine and model from the selected .agents/ file.

Adapter boundary

Each adapter should be limited to starting or resuming a native session, sending a message, streaming output, cancelling a turn, and reporting completion or failure. Facility owns the shared conversation and does not replace the engine's agent loop.

The adapter input includes the workspace, agent prompt, conversation context, model, optional reasoning effort, and native session reference when one exists. The output includes streamed events, the final result, the updated session reference, and enough error detail to retry.

Session handling

Native session files live on durable workspace storage. Database records point to them and record which engine and model created them.

When a later turn uses a compatible session, resume it. If an agent selects another engine or an incompatible model, create another native session in the same workspace and seed it with the shared history and current summary. Keep the earlier session.

A corrupt or unreadable session should be marked unusable and retained for diagnosis. The next turn starts a replacement session without resetting the worktree.

Output and cancellation

Persist the user message before starting the engine. Stream bounded events to MCP and the UI. Save the terminal result and session reference before releasing the story lock.

Cancellation should stop the engine process and leave the workspace recoverable. A lost worker should be able to determine whether the process still runs and either reconnect or close the turn with an actionable error.

Acceptance criteria

  • Claude Code and Codex implement the same adapter contract.
  • The adapter passes the exact model and reasoning effort from the agent manifest.
  • A compatible native session resumes after compute suspension and replacement.
  • Switching agents preserves the worktree and every prior session.
  • Switching engines creates a new session without deleting the old one.
  • Corrupt session state produces a recoverable error and a replacement session.
  • User messages survive a worker crash before engine startup.
  • Output can be consumed incrementally by MCP and the UI.
  • Cancellation leaves Git and local service state untouched.
  • Logs do not contain provider credentials or GitHub tokens.
  • Deterministic fake executables test start, resume, model selection, streaming, cancellation, crash recovery, and corrupt sessions.

Out of scope

Do not normalize every vendor event into a large internal protocol. Store the events the product needs for conversation, progress, diagnosis, and recovery.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names .agents/ manifests, adapter boundaries, MCP, the UI, durable workspace storage, and deterministic fake executables, but no source files or tests. Start by locating the manifest and adapter entry points, then trace session persistence and worker lifecycle; done means the listed acceptance scenarios pass without losing workspaces or credentials.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
ai, backend, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.