agent-mockingbird 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/btca-cli/SKILL.md +64 -0
- package/.agents/skills/btca-cli/agents/openai.yaml +3 -0
- package/.agents/skills/frontend-design/SKILL.md +42 -0
- package/.agents/skills/frontend-design/agents/openai.yaml +3 -0
- package/.env.example +36 -0
- package/.githooks/pre-commit +33 -0
- package/.github/workflows/ci.yml +309 -0
- package/.opencode/bun.lock +18 -0
- package/.opencode/package.json +5 -0
- package/.opencode/tools/agent_type_manager.ts +100 -0
- package/.opencode/tools/config_manager.ts +87 -0
- package/.opencode/tools/cron_manager.ts +145 -0
- package/.opencode/tools/memory_get.ts +43 -0
- package/.opencode/tools/memory_remember.ts +53 -0
- package/.opencode/tools/memory_search.ts +48 -0
- package/AGENTS.md +126 -0
- package/MEMORY.md +2 -0
- package/README.md +451 -0
- package/THIRD_PARTY_NOTICES.md +11 -0
- package/agent-mockingbird.config.example.json +135 -0
- package/apps/server/package.json +32 -0
- package/apps/server/src/backend/agents/bootstrapContext.ts +362 -0
- package/apps/server/src/backend/agents/openclawImport.test.ts +133 -0
- package/apps/server/src/backend/agents/openclawImport.ts +797 -0
- package/apps/server/src/backend/agents/opencodeConfig.ts +428 -0
- package/apps/server/src/backend/agents/service.ts +10 -0
- package/apps/server/src/backend/config/example-config.test.ts +20 -0
- package/apps/server/src/backend/config/orchestration.ts +243 -0
- package/apps/server/src/backend/config/policy.ts +158 -0
- package/apps/server/src/backend/config/schema.test.ts +15 -0
- package/apps/server/src/backend/config/schema.ts +391 -0
- package/apps/server/src/backend/config/semantic.test.ts +34 -0
- package/apps/server/src/backend/config/semantic.ts +149 -0
- package/apps/server/src/backend/config/service.test.ts +75 -0
- package/apps/server/src/backend/config/service.ts +207 -0
- package/apps/server/src/backend/config/smoke.ts +77 -0
- package/apps/server/src/backend/config/store.test.ts +123 -0
- package/apps/server/src/backend/config/store.ts +581 -0
- package/apps/server/src/backend/config/testFixtures.ts +5 -0
- package/apps/server/src/backend/config/types.ts +56 -0
- package/apps/server/src/backend/contracts/events.ts +320 -0
- package/apps/server/src/backend/contracts/runtime.ts +111 -0
- package/apps/server/src/backend/cron/executor.ts +435 -0
- package/apps/server/src/backend/cron/repository.ts +170 -0
- package/apps/server/src/backend/cron/service.ts +660 -0
- package/apps/server/src/backend/cron/storage.ts +92 -0
- package/apps/server/src/backend/cron/types.ts +138 -0
- package/apps/server/src/backend/cron/utils.ts +351 -0
- package/apps/server/src/backend/db/client.ts +20 -0
- package/apps/server/src/backend/db/migrate.ts +40 -0
- package/apps/server/src/backend/db/repository.ts +1762 -0
- package/apps/server/src/backend/db/schema.ts +113 -0
- package/apps/server/src/backend/db/usageDashboard.test.ts +102 -0
- package/apps/server/src/backend/db/wipe.ts +13 -0
- package/apps/server/src/backend/defaults.ts +32 -0
- package/apps/server/src/backend/env.ts +48 -0
- package/apps/server/src/backend/heartbeat/activeHours.ts +45 -0
- package/apps/server/src/backend/heartbeat/defaultJob.ts +88 -0
- package/apps/server/src/backend/heartbeat/heartbeat.test.ts +110 -0
- package/apps/server/src/backend/heartbeat/runtimeService.ts +190 -0
- package/apps/server/src/backend/heartbeat/service.ts +176 -0
- package/apps/server/src/backend/heartbeat/state.test.ts +63 -0
- package/apps/server/src/backend/heartbeat/state.ts +167 -0
- package/apps/server/src/backend/heartbeat/types.ts +54 -0
- package/apps/server/src/backend/http/boundedQueue.test.ts +49 -0
- package/apps/server/src/backend/http/boundedQueue.ts +92 -0
- package/apps/server/src/backend/http/parsers.ts +40 -0
- package/apps/server/src/backend/http/router.ts +61 -0
- package/apps/server/src/backend/http/routes/agentRoutes.ts +67 -0
- package/apps/server/src/backend/http/routes/backgroundRoutes.ts +203 -0
- package/apps/server/src/backend/http/routes/chatRoutes.ts +107 -0
- package/apps/server/src/backend/http/routes/configRoutes.ts +602 -0
- package/apps/server/src/backend/http/routes/cronRoutes.ts +221 -0
- package/apps/server/src/backend/http/routes/dashboardRoutes.ts +308 -0
- package/apps/server/src/backend/http/routes/eventRoutes.ts +7 -0
- package/apps/server/src/backend/http/routes/heartbeatRoutes.test.ts +41 -0
- package/apps/server/src/backend/http/routes/heartbeatRoutes.ts +28 -0
- package/apps/server/src/backend/http/routes/index.ts +101 -0
- package/apps/server/src/backend/http/routes/mcpRoutes.ts +213 -0
- package/apps/server/src/backend/http/routes/memoryRoutes.ts +154 -0
- package/apps/server/src/backend/http/routes/runRoutes.ts +310 -0
- package/apps/server/src/backend/http/routes/runtimeRoutes.ts +197 -0
- package/apps/server/src/backend/http/routes/skillRoutes.ts +112 -0
- package/apps/server/src/backend/http/routes/uiRoutes.test.ts +161 -0
- package/apps/server/src/backend/http/routes/uiRoutes.ts +177 -0
- package/apps/server/src/backend/http/routes/usageRoutes.test.ts +104 -0
- package/apps/server/src/backend/http/routes/usageRoutes.ts +767 -0
- package/apps/server/src/backend/http/schemas.ts +64 -0
- package/apps/server/src/backend/http/sse.ts +144 -0
- package/apps/server/src/backend/integration/backend-core.test.ts +2316 -0
- package/apps/server/src/backend/logging/logger.ts +64 -0
- package/apps/server/src/backend/mcp/service.ts +326 -0
- package/apps/server/src/backend/memory/cli.ts +170 -0
- package/apps/server/src/backend/memory/conceptExpansion.test.ts +28 -0
- package/apps/server/src/backend/memory/conceptExpansion.ts +80 -0
- package/apps/server/src/backend/memory/qmdPort.test.ts +54 -0
- package/apps/server/src/backend/memory/qmdPort.ts +61 -0
- package/apps/server/src/backend/memory/records.test.ts +66 -0
- package/apps/server/src/backend/memory/records.ts +229 -0
- package/apps/server/src/backend/memory/service.ts +2012 -0
- package/apps/server/src/backend/memory/sqliteVec.ts +58 -0
- package/apps/server/src/backend/memory/types.ts +104 -0
- package/apps/server/src/backend/opencode/agentMockingbirdPlugin.test.ts +396 -0
- package/apps/server/src/backend/opencode/client.ts +98 -0
- package/apps/server/src/backend/opencode/models.ts +41 -0
- package/apps/server/src/backend/opencode/systemPrompt.test.ts +146 -0
- package/apps/server/src/backend/opencode/systemPrompt.ts +284 -0
- package/apps/server/src/backend/paths.ts +57 -0
- package/apps/server/src/backend/prompts/service.ts +100 -0
- package/apps/server/src/backend/queue/queue.test.ts +189 -0
- package/apps/server/src/backend/queue/service.ts +177 -0
- package/apps/server/src/backend/queue/types.ts +39 -0
- package/apps/server/src/backend/run/service.ts +576 -0
- package/apps/server/src/backend/run/storage.ts +47 -0
- package/apps/server/src/backend/run/types.ts +44 -0
- package/apps/server/src/backend/runtime/errors.ts +61 -0
- package/apps/server/src/backend/runtime/index.ts +72 -0
- package/apps/server/src/backend/runtime/memoryPromptDedup.test.ts +153 -0
- package/apps/server/src/backend/runtime/memoryPromptDedup.ts +76 -0
- package/apps/server/src/backend/runtime/opencodeRuntime/backgroundMethods.ts +765 -0
- package/apps/server/src/backend/runtime/opencodeRuntime/coreMethods.ts +705 -0
- package/apps/server/src/backend/runtime/opencodeRuntime/eventMethods.ts +503 -0
- package/apps/server/src/backend/runtime/opencodeRuntime/memoryMethods.ts +462 -0
- package/apps/server/src/backend/runtime/opencodeRuntime/promptMethods.ts +1167 -0
- package/apps/server/src/backend/runtime/opencodeRuntime/shared.ts +254 -0
- package/apps/server/src/backend/runtime/opencodeRuntime.test.ts +2899 -0
- package/apps/server/src/backend/runtime/opencodeRuntime.ts +135 -0
- package/apps/server/src/backend/runtime/sessionScope.ts +45 -0
- package/apps/server/src/backend/skills/service.ts +442 -0
- package/apps/server/src/backend/workspace/resolve.ts +27 -0
- package/apps/server/src/cli/agent-mockingbird.mjs +2522 -0
- package/apps/server/src/cli/agent-mockingbird.test.ts +68 -0
- package/apps/server/src/cli/runtime-assets.mjs +269 -0
- package/apps/server/src/cli/runtime-assets.test.ts +52 -0
- package/apps/server/src/cli/runtime-layout.mjs +75 -0
- package/apps/server/src/cli/standaloneBuild.test.ts +19 -0
- package/apps/server/src/cli/standaloneBuild.ts +19 -0
- package/apps/server/src/cli/standaloneCronBinary.test.ts +187 -0
- package/apps/server/src/index.ts +178 -0
- package/apps/server/tsconfig.json +12 -0
- package/backlog.md +5 -0
- package/bin/agent-mockingbird +2522 -0
- package/bin/runtime-layout.mjs +75 -0
- package/build-bin.ts +34 -0
- package/build-cli.mjs +37 -0
- package/build.ts +40 -0
- package/bun-env.d.ts +11 -0
- package/bun.lock +888 -0
- package/bunfig.toml +2 -0
- package/components.json +21 -0
- package/config.json +130 -0
- package/deploy/RELEASE_INSTALL.md +112 -0
- package/deploy/docker-compose.yml +42 -0
- package/deploy/systemd/README.md +46 -0
- package/deploy/systemd/agent-mockingbird.service +28 -0
- package/deploy/systemd/opencode.service +25 -0
- package/docs/legacy-config-ui-reference.md +51 -0
- package/docs/memory-e2e-trace-2026-03-04.md +63 -0
- package/docs/memory-ops.md +96 -0
- package/docs/memory-runtime-contract.md +42 -0
- package/docs/memory-tuning-remote-2026-03-04.md +59 -0
- package/docs/opencode-rebase-workflow-plan.md +614 -0
- package/docs/opencode-startup-sync-plan.md +94 -0
- package/docs/vendor-opencode.md +41 -0
- package/drizzle/0000_famous_turbo.sql +49 -0
- package/drizzle/0001_cron_memory_aux.sql +160 -0
- package/drizzle/0002_runtime_session_bindings.sql +28 -0
- package/drizzle/0003_background_runs.sql +27 -0
- package/drizzle/0004_memory_open_write.sql +63 -0
- package/drizzle/0005_signal_channel.sql +47 -0
- package/drizzle/0006_usage_event_dimensions.sql +7 -0
- package/drizzle/meta/0000_snapshot.json +341 -0
- package/drizzle/meta/_journal.json +55 -0
- package/drizzle.config.ts +14 -0
- package/eslint.config.mjs +77 -0
- package/knip.json +18 -0
- package/memory/2026-03-04.md +4 -0
- package/opencode.lock.json +16 -0
- package/package.json +67 -0
- package/packages/agent-mockingbird-installer/README.md +31 -0
- package/packages/agent-mockingbird-installer/bin/agent-mockingbird-installer.mjs +44 -0
- package/packages/agent-mockingbird-installer/opencode.lock.json +16 -0
- package/packages/agent-mockingbird-installer/package.json +23 -0
- package/packages/contracts/package.json +19 -0
- package/packages/contracts/src/agentTypes.ts +122 -0
- package/packages/contracts/src/cron.ts +146 -0
- package/packages/contracts/src/dashboard.ts +378 -0
- package/packages/contracts/src/index.ts +3 -0
- package/packages/contracts/tsconfig.json +4 -0
- package/patches/opencode/0001-Wafflebot-OpenCode-baseline.patch +2341 -0
- package/patches/opencode/0002-Fix-OpenCode-web-entry-and-settings-icons.patch +104 -0
- package/patches/opencode/0003-fix-app-remove-duplicate-sidebar-mount.patch +32 -0
- package/patches/opencode/0004-Add-heartbeat-settings-and-usage-nav.patch +506 -0
- package/patches/opencode/0005-Use-chart-icon-for-usage-nav.patch +38 -0
- package/patches/opencode/0006-Modernize-cron-settings.patch +399 -0
- package/patches/opencode/0007-Rename-waffle-namespaces-to-mockingbird.patch +1110 -0
- package/patches/opencode/0008-Remove-cron-contract-section.patch +178 -0
- package/patches/opencode/0009-Rework-cron-tab-as-operations-console.patch +414 -0
- package/patches/opencode/0010-Refine-heartbeat-settings-controls.patch +208 -0
- package/runtime-assets/opencode-config/opencode.jsonc +25 -0
- package/runtime-assets/opencode-config/package.json +5 -0
- package/runtime-assets/opencode-config/plugins/agent-mockingbird.ts +715 -0
- package/runtime-assets/workspace/.agents/skills/config-auditor/SKILL.md +25 -0
- package/runtime-assets/workspace/.agents/skills/config-editor/SKILL.md +24 -0
- package/runtime-assets/workspace/.agents/skills/cron-manager/SKILL.md +57 -0
- package/runtime-assets/workspace/.agents/skills/memory-ops/SKILL.md +120 -0
- package/runtime-assets/workspace/.agents/skills/runtime-diagnose/SKILL.md +25 -0
- package/runtime-assets/workspace/AGENTS.md +56 -0
- package/runtime-assets/workspace/MEMORY.md +4 -0
- package/scripts/build-release-bundle.sh +66 -0
- package/scripts/check-ship.ts +383 -0
- package/scripts/dev-opencode.sh +17 -0
- package/scripts/dev-stack-opencode.sh +15 -0
- package/scripts/dev-stack.sh +61 -0
- package/scripts/install-systemd.sh +87 -0
- package/scripts/memory-e2e.sh +76 -0
- package/scripts/memory-trace-e2e.sh +141 -0
- package/scripts/migrate-opencode-env.ts +108 -0
- package/scripts/onboard/bootstrap.sh +32 -0
- package/scripts/opencode-swap.ts +78 -0
- package/scripts/opencode-sync.ts +715 -0
- package/scripts/runtime-assets-sync.mjs +83 -0
- package/scripts/setup-git-hooks.ts +39 -0
- package/tsconfig.json +45 -0
- package/tui.json +98 -0
- package/turbo.json +36 -0
- package/vendor/OPENCODE_VENDOR.md +13 -0
package/bunfig.toml
ADDED
package/components.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema.json",
|
|
3
|
+
"style": "base-new-york",
|
|
4
|
+
"rsc": false,
|
|
5
|
+
"tsx": true,
|
|
6
|
+
"tailwind": {
|
|
7
|
+
"config": "",
|
|
8
|
+
"css": "src/index.css",
|
|
9
|
+
"baseColor": "zinc",
|
|
10
|
+
"cssVariables": true,
|
|
11
|
+
"prefix": ""
|
|
12
|
+
},
|
|
13
|
+
"aliases": {
|
|
14
|
+
"components": "@/components",
|
|
15
|
+
"utils": "@/lib/utils",
|
|
16
|
+
"ui": "@/components/ui",
|
|
17
|
+
"lib": "@/lib",
|
|
18
|
+
"hooks": "@/hooks"
|
|
19
|
+
},
|
|
20
|
+
"iconLibrary": "lucide"
|
|
21
|
+
}
|
package/config.json
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://opencode.ai/config.json",
|
|
3
|
+
"command": {
|
|
4
|
+
"tokenscope": {
|
|
5
|
+
"template": "Call the tokenscope tool directly without delegating to other agents.\nThen cat the token-usage-output.txt. DONT DO ANYTHING ELSE WITH THE OUTPUT.\n• Call the two tools\n• Not add any additional text or formatting after that",
|
|
6
|
+
"description": "Analyze token usage across the current session with detailed breakdowns by category"
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
"skills": {
|
|
10
|
+
"paths": [
|
|
11
|
+
"/var/home/matt/Documents/random-vibecoded-stuff/agent-mockingbird/.agents/skills"
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
"plugin": [
|
|
15
|
+
"file:///var/home/matt/.config/opencode/plugin/tokenscope.ts"
|
|
16
|
+
],
|
|
17
|
+
"model": "anthropic/claude-opus-4-5",
|
|
18
|
+
"small_model": "chutes/openai/gpt-oss-120b-TEE",
|
|
19
|
+
"username": "matt",
|
|
20
|
+
"mode": {},
|
|
21
|
+
"agent": {
|
|
22
|
+
"explore": {
|
|
23
|
+
"model": "chutes/MiniMaxAI/MiniMax-M2.5-TEE",
|
|
24
|
+
"options": {},
|
|
25
|
+
"permission": {}
|
|
26
|
+
},
|
|
27
|
+
"king-mode": {
|
|
28
|
+
"prompt": "# SYSTEM ROLE & BEHAVIORAL PROTOCOLS\n\n**ROLE:** Senior Frontend Architect & Avant-Garde UI Designer.\n**EXPERIENCE:** 15+ years. Master of visual hierarchy, whitespace, and UX engineering.\n\n## 1. OPERATIONAL DIRECTIVES (DEFAULT MODE)\n\n- **Follow Instructions:** Execute the request immediately. Do not deviate.\n- **Zero Fluff:** No philosophical lectures or unsolicited advice in standard mode.\n- **Stay Focused:** Concise answers only. No wandering.\n- **Output First:** Prioritize code and visual solutions.\n\n## 2. THE \"ULTRATHINK\" PROTOCOL (TRIGGER COMMAND)\n\n**TRIGGER:** When the user prompts **\"ULTRATHINK\"**:\n\n- **Override Brevity:** Immediately suspend the \"Zero Fluff\" rule.\n- **Maximum Depth:** You must engage in exhaustive, deep-level reasoning.\n- **Multi-Dimensional Analysis:** Analyze the request through every lens:\n - _Psychological:_ User sentiment and cognitive load.\n - _Technical:_ Rendering performance, repaint/reflow costs, and state complexity.\n - _Accessibility:_ WCAG AAA strictness.\n - _Scalability:_ Long-term maintenance and modularity.\n- **Prohibition:** **NEVER** use surface-level logic. If the reasoning feels easy, dig deeper until the logic is irrefutable.\n\n## 3. DESIGN PHILOSOPHY: \"INTENTIONAL MINIMALISM\"\n\n- **Anti-Generic:** Reject standard \"bootstrapped\" layouts. If it looks like a template, it is wrong.\n- **Uniqueness:** Strive for bespoke layouts, asymmetry, and distinctive typography.\n- **The \"Why\" Factor:** Before placing any element, strictly calculate its purpose. If it has no purpose, delete it.\n- **Minimalism:** Reduction is the ultimate sophistication.\n\n## 4. FRONTEND CODING STANDARDS\n\n- **Library Discipline (CRITICAL):** If a UI library (e.g., Shadcn UI, Radix, MUI) is detected or active in the project, **YOU MUST USE IT**.\n - **Do not** build custom components (like modals, dropdowns, or buttons) from scratch if the library provides them.\n - **Do not** pollute the codebase with redundant CSS.\n - _Exception:_ You may wrap or style library components to achieve the \"Avant-Garde\" look, but the underlying primitive must come from the library to ensure stability and accessibility.\n- **Stack:** Modern (React/Vue/Svelte), Tailwind/Custom CSS, semantic HTML5.\n- **Visuals:** Focus on micro-interactions, perfect spacing, and \"invisible\" UX.\n\n## 5. RESPONSE FORMAT\n\n**IF NORMAL:**\n\n1. **Rationale:** (1 sentence on why the elements were placed there).\n2. **The Code.**\n\n**IF \"ULTRATHINK\" IS ACTIVE:**\n\n1. **Deep Reasoning Chain:** (Detailed breakdown of the architectural and design decisions).\n2. **Edge Case Analysis:** (What could go wrong and how we prevented it).\n3. **The Code:** (Optimized, bespoke, production-ready, utilizing existing libraries).",
|
|
29
|
+
"description": "Reviews code for quality and best practices",
|
|
30
|
+
"mode": "all",
|
|
31
|
+
"options": {},
|
|
32
|
+
"permission": {},
|
|
33
|
+
"name": "king-mode"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"mcp": {},
|
|
37
|
+
"permission": {
|
|
38
|
+
"bash": {
|
|
39
|
+
"git push": "deny",
|
|
40
|
+
"git pull": "deny",
|
|
41
|
+
"git commit": "deny",
|
|
42
|
+
"btca": "allow",
|
|
43
|
+
"sed": "allow",
|
|
44
|
+
"git status": "allow",
|
|
45
|
+
"git diff": "allow",
|
|
46
|
+
"p compile": "allow",
|
|
47
|
+
"pnpm compile": "allow",
|
|
48
|
+
"p lint": "allow",
|
|
49
|
+
"pnpm lint": "allow",
|
|
50
|
+
"pnpm lint:check": "allow",
|
|
51
|
+
"pnpm add": "ask",
|
|
52
|
+
"ls": "allow",
|
|
53
|
+
"grep": "allow",
|
|
54
|
+
"pwd": "allow",
|
|
55
|
+
"rm": "ask",
|
|
56
|
+
"gh pr diff": "allow",
|
|
57
|
+
"rmdir": "ask",
|
|
58
|
+
"unlink": "deny",
|
|
59
|
+
"shred": "deny",
|
|
60
|
+
"git reset": "deny",
|
|
61
|
+
"git clean": "deny",
|
|
62
|
+
"git branch -D": "deny",
|
|
63
|
+
"git branch -d": "deny",
|
|
64
|
+
"git rebase": "deny",
|
|
65
|
+
"git filter-branch": "deny",
|
|
66
|
+
"git checkout -b": "deny",
|
|
67
|
+
"git checkout": "deny",
|
|
68
|
+
"git remote": "deny",
|
|
69
|
+
"git init": "deny",
|
|
70
|
+
"git config": "deny",
|
|
71
|
+
"sudo": "deny",
|
|
72
|
+
"su": "deny",
|
|
73
|
+
"pkexec": "deny",
|
|
74
|
+
"ssh": "deny",
|
|
75
|
+
"scp": "deny",
|
|
76
|
+
"sftp": "deny",
|
|
77
|
+
"rsync": "deny",
|
|
78
|
+
"curl": "deny",
|
|
79
|
+
"wget": "deny",
|
|
80
|
+
"nc": "deny",
|
|
81
|
+
"netcat": "deny",
|
|
82
|
+
"telnet": "deny",
|
|
83
|
+
"ftp": "deny",
|
|
84
|
+
"chmod": "deny",
|
|
85
|
+
"chown": "deny",
|
|
86
|
+
"chgrp": "deny",
|
|
87
|
+
"mount": "deny",
|
|
88
|
+
"umount": "deny",
|
|
89
|
+
"fdisk": "deny",
|
|
90
|
+
"gdisk": "deny",
|
|
91
|
+
"parted": "deny",
|
|
92
|
+
"mkfs": "deny",
|
|
93
|
+
"fsck": "deny",
|
|
94
|
+
"dd": "deny",
|
|
95
|
+
"npm install -g": "deny",
|
|
96
|
+
"npm g": "deny",
|
|
97
|
+
"yarn global": "deny",
|
|
98
|
+
"brew": "deny",
|
|
99
|
+
"apt": "deny",
|
|
100
|
+
"apt-get": "deny",
|
|
101
|
+
"yum": "deny",
|
|
102
|
+
"dnf": "deny",
|
|
103
|
+
"pip": "deny",
|
|
104
|
+
"eval": "deny",
|
|
105
|
+
"exec": "deny",
|
|
106
|
+
"bash": "deny",
|
|
107
|
+
"sh": "deny",
|
|
108
|
+
"zsh": "deny",
|
|
109
|
+
"crontab": "deny",
|
|
110
|
+
"systemctl": "deny",
|
|
111
|
+
"service": "deny",
|
|
112
|
+
"shutdown": "deny",
|
|
113
|
+
"reboot": "deny",
|
|
114
|
+
"halt": "deny",
|
|
115
|
+
"poweroff": "deny",
|
|
116
|
+
"adb install": "deny",
|
|
117
|
+
"adb push": "deny",
|
|
118
|
+
"adb shell": "deny",
|
|
119
|
+
"xcodebuild": "deny",
|
|
120
|
+
"p start": "deny",
|
|
121
|
+
"pnpm start": "deny"
|
|
122
|
+
},
|
|
123
|
+
"skill": {
|
|
124
|
+
"*": "deny",
|
|
125
|
+
"config-auditor": "allow",
|
|
126
|
+
"config-editor": "allow",
|
|
127
|
+
"runtime-diagnose": "allow"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Release + Install
|
|
2
|
+
|
|
3
|
+
This project is published to npm and source-hosted on GitHub.
|
|
4
|
+
|
|
5
|
+
## User onboarding flow (npm + systemd user services)
|
|
6
|
+
|
|
7
|
+
Recommended first-run flow on Linux:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
curl -fsSL "https://raw.githubusercontent.com/waffleophagus/agent-mockingbird/main/scripts/onboard/bootstrap.sh" | bash
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
This installs:
|
|
14
|
+
|
|
15
|
+
- `agent-mockingbird` from npmjs
|
|
16
|
+
- `opencode-ai` from npmjs
|
|
17
|
+
- user services (`opencode.service`, `agent-mockingbird.service`) in `~/.config/systemd/user`
|
|
18
|
+
- automatic service start and health verification
|
|
19
|
+
- interactive onboarding on TTY installs (`provider auth`, default model, memory/Ollama, optional OpenClaw import)
|
|
20
|
+
|
|
21
|
+
Install root defaults to `~/.agent-mockingbird`.
|
|
22
|
+
|
|
23
|
+
After install, operational commands are available through `agent-mockingbird`:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
agent-mockingbird status
|
|
27
|
+
agent-mockingbird restart
|
|
28
|
+
agent-mockingbird update
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Fallback bootstrap wrapper:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
curl -fsSL "https://raw.githubusercontent.com/waffleophagus/agent-mockingbird/main/scripts/onboard/bootstrap.sh" | bash
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Feature branch preview install:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
BRANCH="<branch-name>"
|
|
41
|
+
VERSION="<published-preview-version>"
|
|
42
|
+
AGENT_MOCKINGBIRD_TAG="${VERSION}" \
|
|
43
|
+
curl -fsSL "https://raw.githubusercontent.com/waffleophagus/agent-mockingbird/${BRANCH}/scripts/onboard/bootstrap.sh" | bash
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Maintainer flow (build + publish)
|
|
47
|
+
|
|
48
|
+
1. Add `NPM_TOKEN` as a GitHub Actions repository secret with publish access for the `@waffleophagus` scope.
|
|
49
|
+
2. Push a tag like `v0.1.0` from `main` to publish the release pair to npm tag `latest`.
|
|
50
|
+
3. Push a non-`main` branch as `waffleophagus` to publish a preview pair to npm tag `next`.
|
|
51
|
+
4. Plain pushes to `main` run checks only; they do not publish.
|
|
52
|
+
|
|
53
|
+
For branch previews, pin `AGENT_MOCKINGBIRD_TAG` to the exact published `next` version so the bootstrap script and package version match.
|
|
54
|
+
|
|
55
|
+
Repository build policy:
|
|
56
|
+
|
|
57
|
+
- `dist/app` is treated as a committed artifact generated locally before commit.
|
|
58
|
+
- The repo `pre-commit` hook runs lint, typecheck, `build`, and `build:bin`, then stages `dist/app`.
|
|
59
|
+
- CI no longer rebuilds the OpenCode web bundle from vendored dependencies; it verifies the committed `dist/app` bundle and rebuilds only the standalone runtime binary.
|
|
60
|
+
|
|
61
|
+
## Manual host install flow
|
|
62
|
+
|
|
63
|
+
Clone a tagged revision on your target Linux host, then run the bundled install script:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
git clone https://github.com/waffleophagus/agent-mockingbird.git
|
|
67
|
+
cd agent-mockingbird
|
|
68
|
+
git checkout v0.1.0
|
|
69
|
+
sudo bash scripts/install-systemd.sh
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Optional install overrides:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
sudo AGENT_MOCKINGBIRD_USER=agent-mockingbird \
|
|
76
|
+
AGENT_MOCKINGBIRD_GROUP=agent-mockingbird \
|
|
77
|
+
AGENT_MOCKINGBIRD_APP_DIR=/srv/agent-mockingbird/app \
|
|
78
|
+
AGENT_MOCKINGBIRD_DATA_DIR=/var/lib/agent-mockingbird \
|
|
79
|
+
bash scripts/install-systemd.sh
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Prerequisites on host:
|
|
83
|
+
|
|
84
|
+
- `bun` in `PATH`
|
|
85
|
+
- `opencode` in `PATH`
|
|
86
|
+
- `systemd`
|
|
87
|
+
|
|
88
|
+
After install, verify:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
systemctl status opencode.service --no-pager
|
|
92
|
+
systemctl status agent-mockingbird.service --no-pager
|
|
93
|
+
curl -sS http://127.0.0.1:3001/api/health
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
For tailnet access, expose the local service with:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
tailscale serve --bg 3001
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Install via Git URL (Bun global)
|
|
103
|
+
|
|
104
|
+
No package registry is required. Install directly from the git tag:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
OWNER="<github-owner>"
|
|
108
|
+
REPO="<repo-name>"
|
|
109
|
+
VERSION="v0.1.0"
|
|
110
|
+
bun add -g "github:${OWNER}/${REPO}#${VERSION}"
|
|
111
|
+
agent-mockingbird
|
|
112
|
+
```
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
version: "3.9"
|
|
2
|
+
services:
|
|
3
|
+
opencode:
|
|
4
|
+
image: ghcr.io/sst/opencode:latest
|
|
5
|
+
command: ["serve", "--hostname", "0.0.0.0", "--port", "4096", "--print-logs", "--log-level", "INFO"]
|
|
6
|
+
working_dir: /workspace
|
|
7
|
+
volumes:
|
|
8
|
+
- ../:/workspace
|
|
9
|
+
- agent_mockingbird_data:/var/lib/agent-mockingbird
|
|
10
|
+
environment:
|
|
11
|
+
AGENT_MOCKINGBIRD_MEMORY_API_BASE_URL: http://agent-mockingbird:3001
|
|
12
|
+
OPENCODE_CONFIG_DIR: /var/lib/agent-mockingbird/opencode-config/docker
|
|
13
|
+
OPENCODE_DISABLE_PROJECT_CONFIG: "1"
|
|
14
|
+
ports:
|
|
15
|
+
- "4096:4096"
|
|
16
|
+
|
|
17
|
+
agent-mockingbird:
|
|
18
|
+
image: oven/bun:1.3
|
|
19
|
+
working_dir: /workspace
|
|
20
|
+
command:
|
|
21
|
+
[
|
|
22
|
+
"/bin/bash",
|
|
23
|
+
"-lc",
|
|
24
|
+
"AGENT_MOCKINGBIRD_OPENCODE_BASE_URL=http://opencode:4096 OPENCODE_CONFIG_DIR=/var/lib/agent-mockingbird/opencode-config/docker OPENCODE_DISABLE_PROJECT_CONFIG=1 bun run config:migrate-opencode-env >/dev/null || true; exec bun src/index.ts",
|
|
25
|
+
]
|
|
26
|
+
depends_on:
|
|
27
|
+
- opencode
|
|
28
|
+
volumes:
|
|
29
|
+
- ../:/workspace
|
|
30
|
+
- agent_mockingbird_data:/var/lib/agent-mockingbird
|
|
31
|
+
environment:
|
|
32
|
+
NODE_ENV: production
|
|
33
|
+
PORT: "3001"
|
|
34
|
+
AGENT_MOCKINGBIRD_CONFIG_PATH: /var/lib/agent-mockingbird/agent-mockingbird.config.json
|
|
35
|
+
AGENT_MOCKINGBIRD_DB_PATH: /var/lib/agent-mockingbird/agent-mockingbird.db
|
|
36
|
+
OPENCODE_CONFIG_DIR: /var/lib/agent-mockingbird/opencode-config/docker
|
|
37
|
+
OPENCODE_DISABLE_PROJECT_CONFIG: "1"
|
|
38
|
+
ports:
|
|
39
|
+
- "3001:3001"
|
|
40
|
+
|
|
41
|
+
volumes:
|
|
42
|
+
agent_mockingbird_data:
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Systemd Deployment (Sidecar Model)
|
|
2
|
+
|
|
3
|
+
This setup runs **two services on one VM**:
|
|
4
|
+
|
|
5
|
+
- `opencode.service` (local sidecar on `127.0.0.1:4096`)
|
|
6
|
+
- `agent-mockingbird.service` (dashboard/API on `127.0.0.1:3001`)
|
|
7
|
+
|
|
8
|
+
Both are pinned to one project workspace (`/srv/agent-mockingbird/app`).
|
|
9
|
+
|
|
10
|
+
## 1. Install units
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
sudo install -D -m 0644 deploy/systemd/opencode.service /etc/systemd/system/opencode.service
|
|
14
|
+
sudo install -D -m 0644 deploy/systemd/agent-mockingbird.service /etc/systemd/system/agent-mockingbird.service
|
|
15
|
+
sudo systemctl daemon-reload
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## 2. Enable + start
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
sudo systemctl enable --now opencode.service agent-mockingbird.service
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## 3. Verify
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
systemctl status opencode.service --no-pager
|
|
28
|
+
systemctl status agent-mockingbird.service --no-pager
|
|
29
|
+
curl -sS http://127.0.0.1:3001/api/health
|
|
30
|
+
curl -sS http://127.0.0.1:3001/api/runtime/info
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 4. Logs
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
journalctl -u opencode.service -f
|
|
37
|
+
journalctl -u agent-mockingbird.service -f
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Notes
|
|
41
|
+
|
|
42
|
+
- OpenCode runtime settings (`baseUrl`, `directory`, model/provider/timeouts) now come from agent-mockingbird config JSON (`runtime.opencode.*`), not runtime env vars.
|
|
43
|
+
- Set `AGENT_MOCKINGBIRD_MEMORY_WORKSPACE_DIR` in `agent-mockingbird.service` to the same project path used by `opencode.service` `WorkingDirectory`.
|
|
44
|
+
- If migrating older env-based settings, run `bun run config:migrate-opencode-env` once before service start.
|
|
45
|
+
- Agent edits from Agent Mockingbird persist to the managed OpenCode config dir pointed to by `OPENCODE_CONFIG_DIR`, not to project-local `.opencode`.
|
|
46
|
+
- If OpenCode TUI/web appears different, launch/attach it with the same workspace directory.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[Unit]
|
|
2
|
+
Description=Agent Mockingbird API and Dashboard
|
|
3
|
+
After=network.target opencode.service
|
|
4
|
+
Wants=network.target opencode.service
|
|
5
|
+
|
|
6
|
+
[Service]
|
|
7
|
+
Type=simple
|
|
8
|
+
User=agent-mockingbird
|
|
9
|
+
Group=agent-mockingbird
|
|
10
|
+
WorkingDirectory=/srv/agent-mockingbird/app
|
|
11
|
+
Environment=NODE_ENV=production
|
|
12
|
+
Environment=PORT=3001
|
|
13
|
+
Environment=AGENT_MOCKINGBIRD_CONFIG_PATH=/var/lib/agent-mockingbird/agent-mockingbird.config.json
|
|
14
|
+
Environment=AGENT_MOCKINGBIRD_DB_PATH=/var/lib/agent-mockingbird/agent-mockingbird.db
|
|
15
|
+
Environment=AGENT_MOCKINGBIRD_MEMORY_WORKSPACE_DIR=/srv/agent-mockingbird/app
|
|
16
|
+
Environment=OPENCODE_CONFIG_DIR=__AGENT_MOCKINGBIRD_OPENCODE_CONFIG_DIR__
|
|
17
|
+
Environment=OPENCODE_DISABLE_PROJECT_CONFIG=1
|
|
18
|
+
ExecStart=/usr/bin/env bun apps/server/src/index.ts
|
|
19
|
+
Restart=always
|
|
20
|
+
RestartSec=2
|
|
21
|
+
NoNewPrivileges=true
|
|
22
|
+
PrivateTmp=true
|
|
23
|
+
ProtectSystem=strict
|
|
24
|
+
ProtectHome=read-only
|
|
25
|
+
ReadWritePaths=/srv/agent-mockingbird/app /var/lib/agent-mockingbird
|
|
26
|
+
|
|
27
|
+
[Install]
|
|
28
|
+
WantedBy=multi-user.target
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[Unit]
|
|
2
|
+
Description=OpenCode Sidecar for Agent Mockingbird
|
|
3
|
+
After=network.target
|
|
4
|
+
Wants=network.target
|
|
5
|
+
|
|
6
|
+
[Service]
|
|
7
|
+
Type=simple
|
|
8
|
+
User=agent-mockingbird
|
|
9
|
+
Group=agent-mockingbird
|
|
10
|
+
WorkingDirectory=/srv/agent-mockingbird/app
|
|
11
|
+
Environment=AGENT_MOCKINGBIRD_PORT=3001
|
|
12
|
+
Environment=AGENT_MOCKINGBIRD_MEMORY_API_BASE_URL=http://127.0.0.1:3001
|
|
13
|
+
Environment=OPENCODE_CONFIG_DIR=__AGENT_MOCKINGBIRD_OPENCODE_CONFIG_DIR__
|
|
14
|
+
Environment=OPENCODE_DISABLE_PROJECT_CONFIG=1
|
|
15
|
+
ExecStart=/usr/bin/env opencode serve --hostname 127.0.0.1 --port 4096 --print-logs --log-level INFO
|
|
16
|
+
Restart=always
|
|
17
|
+
RestartSec=2
|
|
18
|
+
NoNewPrivileges=true
|
|
19
|
+
PrivateTmp=true
|
|
20
|
+
ProtectSystem=strict
|
|
21
|
+
ProtectHome=read-only
|
|
22
|
+
ReadWritePaths=/srv/agent-mockingbird/app /var/lib/agent-mockingbird
|
|
23
|
+
|
|
24
|
+
[Install]
|
|
25
|
+
WantedBy=multi-user.target
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Legacy Config UI Reference (Add-Back TODO)
|
|
2
|
+
|
|
3
|
+
Status: keep this while we clone/adapt Opencode UI; use it to reintroduce non-chat functionality.
|
|
4
|
+
|
|
5
|
+
## Goal
|
|
6
|
+
Re-add legacy Agent Mockingbird functionality on top of the Opencode-like React UI after the base shell is stable.
|
|
7
|
+
|
|
8
|
+
## Add Back: Skills
|
|
9
|
+
- Skills list (view/search/sort as needed).
|
|
10
|
+
- Create/edit/delete skill flows.
|
|
11
|
+
- Prompt/content editor with validation.
|
|
12
|
+
- Enable/disable state and persistence.
|
|
13
|
+
|
|
14
|
+
## Add Back: MCP
|
|
15
|
+
- MCP server list + status indicators.
|
|
16
|
+
- Add/edit/remove MCP server configs.
|
|
17
|
+
- Env/header/transport configuration fields.
|
|
18
|
+
- Connect/disconnect/test actions.
|
|
19
|
+
|
|
20
|
+
## Add Back: Agents
|
|
21
|
+
- Agent list and selection UX.
|
|
22
|
+
- Create/edit/duplicate/delete flows.
|
|
23
|
+
- Model, system prompt, and tool-permission settings.
|
|
24
|
+
- Persistence + refresh behavior.
|
|
25
|
+
|
|
26
|
+
## Add Back: Other Settings
|
|
27
|
+
- Runtime/provider/config toggles from legacy UI.
|
|
28
|
+
- Non-chat operational settings.
|
|
29
|
+
- Save/validation/error feedback patterns.
|
|
30
|
+
|
|
31
|
+
## Add Back: Cron
|
|
32
|
+
- Cron job list and schedule editor.
|
|
33
|
+
- Enable/disable/delete controls.
|
|
34
|
+
- Run-now action + last run/error status.
|
|
35
|
+
|
|
36
|
+
## Shared UX/Behavior Requirements
|
|
37
|
+
- Unsaved changes detection + confirm dialog.
|
|
38
|
+
- Consistent toasts for success/error.
|
|
39
|
+
- Loading/empty/error states on each screen.
|
|
40
|
+
- Safe data updates (optimistic only where low risk).
|
|
41
|
+
|
|
42
|
+
## Suggested Reintroduction Order
|
|
43
|
+
1. Skills
|
|
44
|
+
2. Agents
|
|
45
|
+
3. MCP
|
|
46
|
+
4. Other Settings
|
|
47
|
+
5. Cron
|
|
48
|
+
|
|
49
|
+
## Notes
|
|
50
|
+
- Non-production app: breaking changes are acceptable.
|
|
51
|
+
- Favor fresh implementations against current APIs/data shapes.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Memory E2E Trace (QMD + sqlite-vec)
|
|
2
|
+
|
|
3
|
+
Date: 2026-03-04
|
|
4
|
+
Repo: `/var/home/matt/Documents/random-vibecoded-stuff/agent-mockingbird`
|
|
5
|
+
|
|
6
|
+
## Goal
|
|
7
|
+
Verify end-to-end memory ingest and retrieval behavior with the family prompt scenario, and inspect debug traces from the current `qmd_hybrid` pipeline.
|
|
8
|
+
|
|
9
|
+
## Commands Run
|
|
10
|
+
```bash
|
|
11
|
+
bun run src/backend/memory/cli.ts status
|
|
12
|
+
bun run src/backend/memory/cli.ts remember "My wife's name is Tiffany and my daughter is Lucy Lee."
|
|
13
|
+
bun run src/backend/memory/cli.ts sync
|
|
14
|
+
bun run src/backend/memory/cli.ts status
|
|
15
|
+
bun run src/backend/memory/cli.ts search --debug "who is my daughter?"
|
|
16
|
+
bun run src/backend/memory/cli.ts search --debug "who is my wife?"
|
|
17
|
+
bun run src/backend/memory/cli.ts search --debug "family members relatives spouse children parents siblings"
|
|
18
|
+
bun run src/backend/memory/cli.ts search --debug "family"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Raw capture file: `/tmp/agent-mockingbird-memory-trace-output.txt`
|
|
22
|
+
|
|
23
|
+
## Key Results
|
|
24
|
+
|
|
25
|
+
### 1) Vector backend is active
|
|
26
|
+
After sync, memory status showed:
|
|
27
|
+
- `vectorBackendConfigured: "sqlite_vec"`
|
|
28
|
+
- `vectorBackendActive: "sqlite_vec"`
|
|
29
|
+
- `vectorAvailable: true`
|
|
30
|
+
- `vectorDims: 2560`
|
|
31
|
+
- `vectorIndexedChunks: 2`
|
|
32
|
+
|
|
33
|
+
### 2) Specific relation queries work
|
|
34
|
+
Query: `who is my daughter?`
|
|
35
|
+
- Returned memory chunk from `memory/2026-03-04.md#L1`
|
|
36
|
+
- Snippet includes: `... my daughter is Lucy Lee.`
|
|
37
|
+
- Score: `0.9291`
|
|
38
|
+
|
|
39
|
+
Query: `who is my wife?`
|
|
40
|
+
- Returned same chunk
|
|
41
|
+
- Snippet includes: `My wife's name is Tiffany ...`
|
|
42
|
+
- Score: `0.9331`
|
|
43
|
+
|
|
44
|
+
### 3) Broad family queries still fail
|
|
45
|
+
Query: `family members relatives spouse children parents siblings`
|
|
46
|
+
- `debug.rankedLists` showed multiple vector lists with `count: 2`
|
|
47
|
+
- Final `results` was `[]`
|
|
48
|
+
|
|
49
|
+
Query: `family`
|
|
50
|
+
- `debug.rankedLists` also showed vector list counts
|
|
51
|
+
- Final `results` was `[]`
|
|
52
|
+
|
|
53
|
+
## Interpretation
|
|
54
|
+
The vector stage appears to retrieve candidates, but they are filtered out later. Likely reasons in current pipeline:
|
|
55
|
+
- Lexical gating in final filtering rejects candidates that do not share query tokens (`family`, etc.) even when semantic vector match exists.
|
|
56
|
+
- `minScore` threshold can further remove surviving candidates.
|
|
57
|
+
|
|
58
|
+
Relevant code paths:
|
|
59
|
+
- Vector retrieval and fallback: `src/backend/memory/service.ts` (`searchVectorCandidates`)
|
|
60
|
+
- Final filtering: `src/backend/memory/service.ts` (`applyFinalFiltering` + lexical signal check)
|
|
61
|
+
|
|
62
|
+
## Conclusion
|
|
63
|
+
The sqlite-vec backend is working and integrated correctly with existing Ollama embeddings. The remaining miss is primarily in post-retrieval filtering behavior for broad category queries like `family`, not vector indexing itself.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Memory Ops Runbook
|
|
2
|
+
|
|
3
|
+
This runbook is for Agent Mockingbird operators maintaining OpenCode-backed memory.
|
|
4
|
+
|
|
5
|
+
## Source of Truth
|
|
6
|
+
|
|
7
|
+
- Durable files in workspace:
|
|
8
|
+
- `MEMORY.md`
|
|
9
|
+
- `memory/*.md`
|
|
10
|
+
- Indexed state in Agent Mockingbird SQLite tables:
|
|
11
|
+
- `memory_files`
|
|
12
|
+
- `memory_chunks`
|
|
13
|
+
- `memory_chunks_fts`
|
|
14
|
+
- `memory_records`
|
|
15
|
+
- `memory_embedding_cache`
|
|
16
|
+
- `memory_write_events`
|
|
17
|
+
|
|
18
|
+
## Routine Operations
|
|
19
|
+
|
|
20
|
+
- Check status:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
bun run memory:status
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
- Incremental sync (normal path):
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
bun run memory:sync
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
- Forced rebuild (index corruption/config drift):
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
bun run memory:reindex
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
- Write-path validation and history:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
bun run memory:activity 20
|
|
42
|
+
bun run memory:lint
|
|
43
|
+
bun run memory:migrate-format
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## API Equivalents
|
|
47
|
+
|
|
48
|
+
- `GET /api/memory/status`
|
|
49
|
+
- `GET /api/memory/activity?limit=20`
|
|
50
|
+
- `POST /api/memory/sync`
|
|
51
|
+
- `POST /api/memory/reindex`
|
|
52
|
+
- `POST /api/memory/retrieve`
|
|
53
|
+
- `POST /api/memory/read`
|
|
54
|
+
- `POST /api/memory/remember`
|
|
55
|
+
- `POST /api/memory/remember/validate`
|
|
56
|
+
|
|
57
|
+
## When to Use Sync vs Reindex
|
|
58
|
+
|
|
59
|
+
- Use `sync` for normal operation and regular maintenance.
|
|
60
|
+
- Use `reindex` when:
|
|
61
|
+
- embedding provider/model changed,
|
|
62
|
+
- file/index mismatch is suspected,
|
|
63
|
+
- retrieval quality regressed after significant workspace updates.
|
|
64
|
+
|
|
65
|
+
## Recommended Baseline Knobs
|
|
66
|
+
|
|
67
|
+
- `runtime.memory.toolMode`: `tool_only`
|
|
68
|
+
- `runtime.memory.maxResults`: `4`
|
|
69
|
+
- `runtime.memory.minScore`: `0.35`
|
|
70
|
+
- `runtime.memory.retrieval.engine`: `qmd_hybrid`
|
|
71
|
+
- `runtime.memory.retrieval.strongSignalMinScore`: `0.85`
|
|
72
|
+
- `runtime.memory.retrieval.strongSignalMinGap`: `0.15`
|
|
73
|
+
- `runtime.memory.retrieval.conceptExpansionEnabled`: `true`
|
|
74
|
+
- `runtime.memory.retrieval.conceptExpansionMaxPacks`: `3`
|
|
75
|
+
- `runtime.memory.retrieval.conceptExpansionMaxTerms`: `10`
|
|
76
|
+
- `runtime.memory.retrieval.semanticRescueEnabled`: `true`
|
|
77
|
+
- `runtime.memory.retrieval.semanticRescueMinVectorScore`: `0.75`
|
|
78
|
+
- `runtime.memory.retrieval.semanticRescueMaxResults`: `2`
|
|
79
|
+
|
|
80
|
+
## Failure Handling
|
|
81
|
+
|
|
82
|
+
- `Memory is disabled.`
|
|
83
|
+
- Check `runtime.memory.enabled` in config.
|
|
84
|
+
- Ollama/embed failures
|
|
85
|
+
- Verify `runtime.memory.ollamaBaseUrl`, provider/model availability, and network reachability.
|
|
86
|
+
- Empty retrieval despite expected content
|
|
87
|
+
- Run `reindex`, then test with `memory:search`.
|
|
88
|
+
- Use `memory:search --debug "<query>"` to inspect retrieval legs and expansion behavior.
|
|
89
|
+
- Duplicate write rejections
|
|
90
|
+
- Expected behavior; check `memory_write_events`/`memory:activity` and write with supersession intent when replacing data.
|
|
91
|
+
|
|
92
|
+
## Operational Notes
|
|
93
|
+
|
|
94
|
+
- Keep OpenCode workspace and memory workspace aligned.
|
|
95
|
+
- Prefer deterministic maintenance via cron `memory.maintenance` if periodic sync is needed.
|
|
96
|
+
- Treat memory markdown as canonical; do not manually edit SQLite memory tables.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Memory Runtime Contract
|
|
2
|
+
|
|
3
|
+
This contract defines how OpenCode runtime memory is expected to behave in Agent Mockingbird.
|
|
4
|
+
|
|
5
|
+
## Contract
|
|
6
|
+
|
|
7
|
+
- Memory files in workspace (`MEMORY.md`, `memory/*.md`) are canonical.
|
|
8
|
+
- Runtime retrieval uses hybrid ranking over text + vector signals.
|
|
9
|
+
- `memory_get` only reads allowed memory paths.
|
|
10
|
+
- `memory_remember` validates input and logs accepted/rejected events.
|
|
11
|
+
|
|
12
|
+
## Tool Modes
|
|
13
|
+
|
|
14
|
+
- Default mode is `tool_only`.
|
|
15
|
+
- `hybrid`: prompt memory injection and memory tool policy are active.
|
|
16
|
+
- `inject_only`: prompt memory injection only.
|
|
17
|
+
- `tool_only`: no prompt injection; retrieval/writes via tools only.
|
|
18
|
+
|
|
19
|
+
## Retrieval Rules
|
|
20
|
+
|
|
21
|
+
- Query flow:
|
|
22
|
+
1. refresh index (cooldown-aware),
|
|
23
|
+
2. run BM25 probe and skip expansion when strong signal thresholds are met,
|
|
24
|
+
3. optionally expand typed queries (`lex|vec|hyde`) and route `lex->FTS`, `vec/hyde->vector`,
|
|
25
|
+
4. fuse result lists with reciprocal rank fusion (RRF), then apply recency and record-state weighting,
|
|
26
|
+
5. blend rank/rerank signals, apply relevance filtering, and return citations (`path#line`) with clipped snippets.
|
|
27
|
+
- Prompt injection dedupe tracks already-injected memory keys per session generation and resets on session compaction.
|
|
28
|
+
- Retrieval defaults are controlled by `runtime.memory.retrieval.*` and can fall back to `legacy` mode.
|
|
29
|
+
|
|
30
|
+
## Write Rules
|
|
31
|
+
|
|
32
|
+
- Empty content is rejected.
|
|
33
|
+
- Duplicate active records are rejected.
|
|
34
|
+
- Accepted writes append compact structured markdown blocks under `memory/YYYY-MM-DD.md` and are indexed.
|
|
35
|
+
- Every write attempt is logged in memory activity.
|
|
36
|
+
|
|
37
|
+
## Interfaces
|
|
38
|
+
|
|
39
|
+
- Memory API routes under `/api/memory/*`.
|
|
40
|
+
- OpenCode plugin-provided memory tools under the managed OpenCode config dir `plugins/agent-mockingbird.ts`.
|
|
41
|
+
- Operator CLI via `bun run memory:*` scripts.
|
|
42
|
+
- Retrieval debug can be requested via `POST /api/memory/retrieve` with `{ "debug": true }`.
|