The Problem

Developers using Claude Code or OpenCode must repeatedly recreate context—identity, recent work, and project state—each session. Without a persistent, searchable memory layer, agents lose continuity, and users spend time re‑briefing the model or rebuilding reminders.

What This Does

macrodata adds a local, file‑based knowledge store that the agent reads on start‑up. Core state lives under plugins/macrodata/src/config.ts (paths for identity.md, journal.md, etc.) and is indexed by the embedding pipeline in plugins/macrodata/opencode/conversations.ts.

Two entry points drive the system:

  • CLI daemon – plugins/macrodata/bin/macrodata-daemon.ts runs as a cron‑style background process, loading schedules (loadAllSchedules → plugins/macrodata/opencode/tools.ts) and firing reminders (execute).
  • Plugin init – plugins/macrodata/opencode/index.ts registers the MacrodataPlugin with Claude Code, exposing functions like start and triggerAgent that inject the current context into every model call.

Memory distillation, “dream time”, and autonomous scheduling are implemented as scheduled tasks that call embedBatch, updateAllConversationIndexes, and the journal helpers in plugins/macrodata/opencode/journal.ts.

How It Is Wired

Execution begins in plugins/macrodata/bin/macrodata-daemon.ts → main (line 640 of src/index.ts). main calls ensureDirectories (creates the state tree) and then loadAllSchedules.

  • loadAllSchedules (in opencode/tools.ts) reads schedule files via getRemindersDir (defined in src/config.ts) and builds in‑memory Schedule objects.
  • When a schedule fires, execute (same file) invokes the Claude Code CLI through detectUser.exec (via src/detect-user.ts).
  • All logging funnels through plugins/macrodata/opencode/logger.ts; the logger is called 5–16 times across the code base, making it a low‑instability, high‑blast‑radius hub.

Conversation indexing follows: plugins/macrodata/opencode/conversations.ts → getEmbeddingPipeline → embedBatch (calls getEmbeddingPipeline again) → stores vectors in JSON under the entities directory (path from src/config.ts).

The plugin entry MacrodataPlugin (in opencode/index.ts) registers start → log → ensureDirectories → loadAllSchedules. No circular imports were detected, but src/config.ts is the most‑connected module (imported by 8 others, never imports back), so changes to path helpers affect the majority of the code.

How To Use It

# Clone the repo
git clone https://github.com/moses-y/macrodata
cd macrodata

# Install dependencies (pnpm is declared; Bun is used for runtime)
pnpm install   # or `bun install` if Bun is preferred

# Register the plugin in Claude Code
/plugin marketplace add ascorbic/macrodata
/plugin install macrodata@macrodata

# For OpenCode, add the plugin name to ~/.config/opencode/opencode.json
# (see README snippet)
{
  "plugin": ["@macrodata/opencode"]
}

To start the autonomous scheduler locally:

# Run the daemon (the script expects a Unix‑like environment)
pnpm exec ts-node plugins/macrodata/bin/macrodata-daemon.ts

Configuration files are plain markdown/JSON under the state root returned by getStateRoot (default ~/.macrodata). No additional environment variables are required.

Real‑World Use

A developer adds a daily reminder “review PRs at 10 am”. The reminder file is written by saveSchedule → plugins/macrodata/opencode/tools.ts. At 10 am the daemon calls execute, which runs the Claude Code CLI with the current context (identity, recent journal entries). The model receives a prompt pre‑populated with today.md and the latest journal excerpt, allowing it to suggest actionable review steps without further prompting.

Code Health & Issues

  • High – Duplicated code blocks – Repeated 6‑line snippets across 9 files (macrodata-daemon.ts, tools.ts, src/index.ts, context.ts). Extract to shared helpers.
  • High – Pin GitHub Actions – Workflows reference tags (navikt/github-app-token-generator@v1). Replace with commit SHAs to avoid supply‑chain risk.
  • High – Missing LICENSE – No license file; default is “all rights reserved”. Add MIT/Apache‑2.0 to enable reuse.
  • Medium – High branching density – macrodata-hook.sh contains 59 branches in 201 lines; consider refactoring to strategy objects.
  • Medium – GITHUB_TOKEN permissions – Workflow test.yml lacks explicit permissions:; declare least‑privilege (e.g., contents: read).
  • Medium – No Dependabot – Add .github/dependabot.yml to keep dependencies patched.
  • Medium – No dependency‑review step – Insert dependency-review-action or osv-scanner in CI.
  • Low – No job timeouts – Add timeout-minutes to each workflow job to prevent runaway runs.

The Bottom Line

macrodata provides a concrete, file‑based memory layer and autonomous scheduler for Claude Code/OpenCode with clear entry points and modest runtime footprint. The codebase is functional but suffers from duplicated utilities, a complex shell script, and several SDLC gaps (license, CI hardening). It is suitable for teams comfortable extending TypeScript plugins and willing to address the identified health issues before production use.