Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Recall OpenCode Phase 4 Handoff

Status: Complete — implementation branch ready for PR

Phase: OpenCode integration — Testing + Polish

Source plan: `.agents/atlas/plans/2026-07-22-opencode-phase4-testing-polish.md`

## Current state

OpenCode MCP registration, extraction, compaction context injection, and batch markdown discovery are already present in `opencode/`, `hooks/RecallBatchExtract.ts`, and `lib/install-lib.sh`.

The remaining phase work is real disposable runtime validation, failure/retry observability, concurrent shared-WAL coverage, and installer JSON/JSONC rollback/preservation coverage.

## Delivered

- `d5ca134` adds the current OpenCode event/export adapter contract, unit tests,
disposable runtime e2e, concurrent WAL coverage, and package entry point.
- `a6e18a4` makes OpenCode uninstall JSONC-safe and adds valid/malformed config
rollback tests.
- `a28d544` makes hook SQLite writers wait on short WAL peer transactions and
proves concurrent record preservation in the isolated e2e.
- `b4e3abd` updates OpenCode integration, installation, upgrade, troubleshooting,
and changelog documentation.

## Completion evidence required

- Actual OpenCode 1.18.4 runtime/export evidence from the disposable e2e.
- Passing focused e2e, concurrency, installer, lint, shell syntax, and package/
integration validation. The full suite reached 1,266 pass / 1 fail: the
unchanged `tests/hooks/RecallExtract-archive-scrub.test.ts` Claude JSONL case
expects a missing LoA transcript and reproduces in isolation on this base;
it is outside OpenCode Phase 4 scope and is called out in the PR.
- Updated OpenCode documentation and focused Unreleased changelog entry.
- Direct PR to `main` with #243 and #165 linked accurately.

## Holds

No unresolved captain product decision is recorded for this phase.
57 changes: 57 additions & 0 deletions .agents/atlas/plans/2026-07-22-opencode-phase4-testing-polish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Recall OpenCode Phase 4: Testing + Polish

Status: Complete — implementation branch ready for PR

Authority: `docs/OPENCODE_INTEGRATION.md:354-408`, promoted scout report, and captain ship instructions.

## Goal

Prove and harden the existing OpenCode adapter without changing Recall core, MCP semantics, host scope, or database ownership.

## Scope

- Add a disposable OpenCode export/drop/extract/search e2e validator with an isolated HOME, RECALL_HOME, RECALL_DB_PATH, and OpenCode configuration.
- Cover export failure and retry, tracker behavior, concurrent OpenCode/Claude writes, and installer JSON/JSONC rollback/preservation behavior.
- Resolve only the #243/#165 worktree/test-environment overlap required for deterministic honest validation.
- Update OpenCode-facing documentation and the focused Unreleased changelog entry.

## Non-goals

Do not implement semantic #240/#241/#226 work, Codex lifecycle capture, a broad installer cleanup, a release/version bump, or production/local Recall installation reconciliation.

## Acceptance

- The validator proves session event to markdown export to drop directory to `RecallBatchExtract` to searchable record.
- Failure/retry and concurrent shared-WAL behavior are asserted in isolated fixtures.
- OpenCode JSON/JSONC config preservation, malformed-config failure, rollback, update, and uninstall behavior are asserted.
- Worker-worktree tests, full Bun tests, lint, shell syntax checks, and package/integration checks pass.
- The verified runtime contract and limitations are documented.

## Delivery slices

1. Add deterministic adapter seams and unit tests for export/retry and runtime evidence.
2. Add the isolated e2e validator and relevant package/CI entry point.
3. Add concurrency and installer rollback coverage, fixing only exposed OpenCode seams.
4. Update docs/changelog, run all checks, commit focused slices, and open a direct PR to `main`.

## Delivered

- `scripts/e2e-opencode.ts` provisions OpenCode 1.18.4 in disposable HOME/XDG
roots and proves event → JSON export → markdown drop → batch extraction →
searchable Recall retrieval.
- The adapter now uses the current `event`/`properties.sessionID` contract,
normalizes full export JSON, retries failed exports, and reports tracker/write
failures.
- Batch extraction uses argument-safe child processes and inspects stderr so
caught failures cannot masquerade as success.
- OpenCode install/update/uninstall coverage preserves JSONC and unrelated MCP
entries; malformed configs remain byte-identical and fail nonzero.
- Documentation and `[Unreleased]` changelog entries describe the current
runtime contract and operational checks.

## Dependencies and references

- #243: worktree lifecycle/config failures and failed-write status contract.
- #165: fresh worktree dependency provisioning.
- #124: existing atomic config-write overlap; do not duplicate it without a test-proven need.
- #236, #237, #238, and #174 remain separate follow-ups.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ jobs:
- name: Build
run: bun run build

- name: OpenCode integration e2e
run: bun run test:e2e:opencode

ubuntu-smoke:
name: Ubuntu compatibility smoke
runs-on: ubuntu-latest
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,23 @@ note in the 0.9.0 entry.

## [Unreleased]

### Added

- **OpenCode Phase 4 validation** — an isolated end-to-end harness provisions
OpenCode 1.18.4, verifies the current `session.idle` event and JSON export
contract, exercises export retry, concurrent WAL writers, installer/update
idempotence, JSONC-preserving uninstall, and searchable Recall retrieval.

### Changed

- OpenCode session capture now uses `opencode export <session-id>` JSON and
normalizes the complete `{ info, messages }` response to markdown. Failed
exports and tracker writes remain visible and retryable; batch extraction uses
argument-safe child-process execution and cannot treat failure output as success.
- OpenCode uninstall removes only Recall's MCP entry through the shared JSONC
parser, preserving unrelated user configuration and leaving malformed files
untouched.

## [0.9.4] — 2026-07-15 — "the tier that wasn't there"

Patch release: every change restores behavior that was already promised and
Expand Down
12 changes: 8 additions & 4 deletions FOR_OPENCODE.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,14 @@ OpenCode first.

A Recall plugin (`RecallExtract.ts`) runs inside OpenCode:

1. Hooks into the `session.idle` event (fires when the agent finishes responding)
2. Exports the session as markdown via `opencode session export`
3. Drops the file into `~/.claude/MEMORY/opencode-sessions/`
4. A batch extraction cron job processes these files into structured memory
1. Handles OpenCode's `event` hook and filters `session.idle` at `event.properties.sessionID`
2. Runs `opencode export <session-id>` and normalizes its JSON `{ info, messages }` response to markdown
3. Drops the file into `$RECALL_HOME/MEMORY/opencode-sessions/`
4. A batch extraction job quality-gates these files into the shared SQLite database

The plugin records a session only after the export and drop write succeed, so
failed exports remain retryable. OpenCode must be available on `PATH`, and the
plugin runtime requires Bun. Verify both with `opencode --version` and `bun --version`.

## Database Location

Expand Down
Loading