Skip to content

feat(aidd-context): sync project memory at OpenCode and Kilo session start #790

Description

@waewoo

Problem

aidd-context ships hooks/hooks.json, which runs update_memory.js at Claude Code SessionStart. That script refreshes the generated memory block in the project's already-wired context files.

OpenCode flat output currently declares hooks unsupported, and the pending Kilo flat contract does the same. AIDD therefore installs skills and agents for those tools but does not install the automatic memory synchronization hook. Memory can still be synchronized manually by 02-project-memory, but it is not refreshed when a session begins.

This is not a request to convert hooks.json: both tools use local JavaScript/TypeScript plugins and their event APIs. Kilo support in this issue is conditional: PR #745 is a draft, has not been reviewed or merged, and may not be accepted.

Scope

  • Implement the project-memory synchronization behavior as local plugin adapters:
    • OpenCode: a project plugin under .opencode/plugins/.
    • Kilo: a project plugin under .kilo/plugin/, only after Kilo is a supported target.
  • Verify the documented session-start-equivalent event for each tool and invoke the sync once per newly created session; do not infer a Claude event-name mapping.
  • Reuse one implementation of the memory-sync logic. Extract a shared core from update_memory.js, or otherwise prove that no behavior is duplicated between Claude, OpenCode, and Kilo.
  • Preserve the current guard behavior: no memory bank or no existing managed block means no unexpected file creation; malformed markers are reported without overwriting user content.
  • Make a plugin failure non-blocking for the AI session and surface a useful diagnostic.
  • Add the corresponding target-specific hook support only when a runtime smoke test proves that the plugin loads and the event fires.
  • Update 08-hook-generate so it can direct a user to the supported plugin shape instead of offering declarative hook output for OpenCode or Kilo.

Acceptance criteria

  • In a real OpenCode project containing an already-wired aidd_docs/memory/ bank and AGENTS.md, starting a new session refreshes the generated memory block exactly once.
  • The OpenCode plugin is loaded from the documented project plugin directory and does not require a global installation.
  • If the bank is absent, no managed block exists, or markers are malformed, the plugin does not overwrite files or prevent the session from starting; it reports the reason.
  • A second session with unchanged memory produces no content drift.
  • The Kilo equivalent passes the same runtime checks only after feat(cli): add Kilo Code support #745 is merged; otherwise the Kilo work remains explicitly blocked.
  • The Kilo plugin is loaded from .kilo/plugin/ and is tested through the Kilo CLI or VS Code extension, not only by inspecting files.
  • The implementation shares the sync logic with the existing Claude hook rather than maintaining independent copies.
  • Existing Claude, Cursor, Codex, and Copilot hook behavior remains unchanged.
  • Unit, integration, golden, typecheck, lint, and target-runtime smoke tests pass for every implemented target.

Prior art in this repository

External references, verified 2026-09-06

  • OpenCode plugins: local project plugins are JavaScript/TypeScript modules under .opencode/plugins/.
  • Kilo plugins: project plugins load from .kilo/plugin/; they are JavaScript/TypeScript modules and expose session events such as session.created.

Relation to the intentional YAGNI decision

This is separate from the rules/commands work in #789. The scope comment on draft PR #745 records why those static artifact kinds were intentionally skipped. Hooks are different: they are executable lifecycle integrations and require target-native plugin adapters.

Out of scope

Activity

  1. waewoo commented on Sep 12, 2026

    @waewoo
    ContributorAuthor

    Update: OpenCode support appears to be covered by #795

    While looking at the current OpenCode flat output, I noticed that part of this issue has effectively been implemented by #795.

    PR #795 introduced the OpenCode hooks bridge:

    cli/src/contexts/tools/domain/profiles/opencode/opencode-hooks-bridge.ts

    It translates AIDD declarative hooks.json definitions into an actual OpenCode JS plugin at build/translate time.

    As a result, the OpenCode flat distribution can now contain the generated plugin required to trigger AIDD hooks, instead of silently dropping them.

    Relevant references:

    So unless I'm missing something, the status of this issue now seems to be:

    Tool Status
    OpenCode ✅ Covered by #795 via the generated hooks bridge
    Kilo Code ⏳ Still to be addressed / verified

    The Kilo part therefore still seems relevant, especially since Kilo uses its own plugin discovery path/runtime (.kilo/plugin/) and we should not assume that the OpenCode-generated bridge is automatically picked up there.

    It might be useful to update the scope of this issue accordingly, so future work does not duplicate the OpenCode implementation already introduced by #795.

  2. waewoo commented on Sep 12, 2026

    @waewoo
    ContributorAuthor

    Closing this issue because its remaining Kilo-specific scope is now explicitly tracked by #744 and assigned to #745.

    The OpenCode portion is covered by #795, as documented above. #744 and #745 now require the corresponding Kilo-native lifecycle-plugin bridge under .kilo/plugin/, with independent Kilo runtime validation; this does not claim that the Kilo implementation is already complete.

  3. moved this from Ideation to Done in AIDD Roadmapon Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Fields

    Priority

    Medium

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions