From 9892012d8b4ec5b608e8660be1ed84256b79b379 Mon Sep 17 00:00:00 2001 From: Ralph Chang Date: Sun, 26 Apr 2026 14:17:54 +0800 Subject: [PATCH] chore: prepare for v1.2.0 release - Bump version to 1.2.0 - Add package.json exports and files whitelist - Update .gitignore to exclude .opencode/ and .opencode-agenthub/ - Fix docs: active files tracked in tool.execute.after (not before) - Fix docs: exitCode undefined is ignored (not success) - Fix docs: session ID is hashed in storage path - Fix docs: workspace memory survives within same workspace --- .gitignore | 5 +++++ docs/architecture.md | 20 ++++++++++---------- docs/configuration.md | 9 ++++++++- package.json | 11 ++++++++++- 4 files changed, 33 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 52f7f3e..9e8870f 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,8 @@ pnpm-lock.yaml # Git worktrees .worktrees/ + +# OpenCode plugin runtime +.opencode/ +.opencode-agenthub/ +.opencode-agenthub.user.json diff --git a/docs/architecture.md b/docs/architecture.md index a682039..f13c8d4 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -11,7 +11,7 @@ The Working Memory Plugin implements a **three-layer memory architecture** desig │ • Types: feedback | project | decision | reference │ │ • Sources: explicit | compaction | manual │ │ • Limits: 5200 chars / 28 entries │ -│ • Survives: session reset, workspace switch │ +│ • Survives: session reset, compaction (same workspace) │ └─────────────────────────────────────────────────────────────┘ ↓ ┌─────────────────────────────────────────────────────────────┐ @@ -135,16 +135,16 @@ Track current session context automatically: ### Active Files -Automatically tracked from `tool.execute.before` events: +Automatically tracked from `tool.execute.after` events: -| Action | Ranking Boost | -|--------|---------------| -| `write` | 4x | -| `edit` | 3x | -| `read` | 2x | -| `grep` | 1x | +| Action | Weight | +|--------|--------| +| `edit` | 50 | +| `write` | 45 | +| `grep` | 30 | +| `read` | 20 | -Files are ranked by: `count * action_weight * recency_decay` +Files are ranked by: `ACTION_WEIGHT[action] + count * 3` ### Open Errors @@ -161,7 +161,7 @@ Tracked from `tool.execute.after` events when `exitCode !== 0`: **False Positive Guards**: - Commands like `git log`, `cat` with "error" in output are ignored - Only actual command failures (`exitCode !== 0`) trigger errors -- `exitCode === undefined` is treated as success (no error tracking) +- `exitCode === undefined` is ignored (no error created, no error cleared) ### Error Fingerprinting diff --git a/docs/configuration.md b/docs/configuration.md index 3472baa..8e2aa84 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -90,7 +90,7 @@ Score formula: `count * action_weight * recency_decay` └── {workspaceKey}/ ├── workspace-memory.json # Long-term memory └── sessions/ - └── {sessionID}.json # Session state + └── {hashedSessionID}.json # Session state (hashed) ``` ### Workspace Key @@ -100,6 +100,13 @@ Score formula: `count * action_weight * recency_decay` const workspaceKey = sha256(realpath(workspaceRoot)).slice(0, 16); ``` +### Session ID + +```typescript +// Hashed session ID for privacy +const hashedSessionID = sha256(sessionID).slice(0, 32); +``` + ## Customization To customize limits, edit the constants in `src/types.ts`: diff --git a/package.json b/package.json index ca831e1..43311f1 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,18 @@ { "name": "opencode-working-memory", - "version": "1.1.2", + "version": "1.2.0", "description": "Three-layer memory architecture for OpenCode with workspace memory and hot session state", "type": "module", "main": "index.ts", + "exports": { + ".": "./index.ts" + }, + "files": [ + "index.ts", + "src/", + "README.md", + "LICENSE" + ], "scripts": { "build": "node -e \"console.log('No build step required: OpenCode loads index.ts directly')\"", "typecheck": "tsc --noEmit",