@vaur94/agz-memory 0.4.0 → 0.5.0

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  [English](backup-restore-runbook.md) | Türkçe
4
4
 
5
- Bu runbook `@vaur94/agz-memory@0.4.0` ve SQLite schema v10 için geçerlidir.
5
+ Bu runbook `@vaur94/agz-memory@0.5.0` ve SQLite schema v11 için geçerlidir.
6
6
 
7
7
  ## Ön Koşullar
8
8
 
@@ -25,19 +25,19 @@ Tahmin edilmiş veya boş bir yolla devam etmeyin.
25
25
  Önce salt-okunur sağlık raporu alın:
26
26
 
27
27
  ```sh
28
- bunx --package @vaur94/agz-memory@0.4.0 agz-memory-admin doctor
28
+ bunx --package @vaur94/agz-memory@0.5.0 agz-memory-admin doctor
29
29
  ```
30
30
 
31
31
  `ok` değeri `true` olmalıdır. `schemaVersion`, satır sayıları ve değişmez kural
32
32
  sayılarını kaydedin. Sonra bağımsız doğrulanmış yedek oluşturup yükseltin:
33
33
 
34
34
  ```sh
35
- bunx --package @vaur94/agz-memory@0.4.0 agz-memory-admin backup
36
- bunx --package @vaur94/agz-memory@0.4.0 agz-memory-admin upgrade --to 10
37
- bunx --package @vaur94/agz-memory@0.4.0 agz-memory-admin doctor
35
+ bunx --package @vaur94/agz-memory@0.5.0 agz-memory-admin backup
36
+ bunx --package @vaur94/agz-memory@0.5.0 agz-memory-admin upgrade --to 11
37
+ bunx --package @vaur94/agz-memory@0.5.0 agz-memory-admin doctor
38
38
  ```
39
39
 
40
- Veritabanı v10'dan eskiyse yükseltme ayrıca değişiklikten önce doğrulanmış yedek
40
+ Veritabanı v11'den eskiyse yükseltme ayrıca değişiklikten önce doğrulanmış yedek
41
41
  oluşturur. Yazdırılan her manifest yolunu ve SHA-256 değerini saklayın. Son rapor
42
42
  `ok: false` ise yazıcı başlatmayın.
43
43
 
@@ -54,16 +54,16 @@ Manifest formatı `agz-memory-backup/1` olur. `agz-memory-admin restore`, manife
54
54
  ile veritabanının aynı yedek dizinindeki normal dosyalar olduğunu doğrular;
55
55
  ardından boyut, SHA-256, SQLite bütünlüğü, foreign key ve satır sayılarını denetler.
56
56
 
57
- Final `0.4.0` ön sürüm manifest formatlarını kabul etmez. Böyle bir yedeği onu
57
+ Final `0.5.0` ön sürüm manifest formatlarını kabul etmez. Böyle bir yedeği onu
58
58
  oluşturan ön sürümle geri yükleyin, o sürümün doctor kontrolünü çalıştırın ve
59
- yalnız bundan sonra geri yüklenen veritabanını `0.4.0` ile yükseltin.
59
+ yalnız bundan sonra geri yüklenen veritabanını `0.5.0` ile yükseltin.
60
60
 
61
61
  ## Geri Yükleme Provası
62
62
 
63
63
  Tüm yazıcıları kapalı tutun. Önce onay vermeden deneme yapın:
64
64
 
65
65
  ```sh
66
- bunx --package @vaur94/agz-memory@0.4.0 agz-memory-admin restore \
66
+ bunx --package @vaur94/agz-memory@0.5.0 agz-memory-admin restore \
67
67
  "$OPENCODE_MEMORY_DATABASE_PATH.backup/<backup>.manifest.json"
68
68
  ```
69
69
 
@@ -71,7 +71,7 @@ bunx --package @vaur94/agz-memory@0.4.0 agz-memory-admin restore \
71
71
  değerlerini kaydedilen yedekle karşılaştırın. Sonra tam manifest özetini kullanın:
72
72
 
73
73
  ```sh
74
- bunx --package @vaur94/agz-memory@0.4.0 agz-memory-admin restore \
74
+ bunx --package @vaur94/agz-memory@0.5.0 agz-memory-admin restore \
75
75
  "$OPENCODE_MEMORY_DATABASE_PATH.backup/<backup>.manifest.json" \
76
76
  --sha256 <manifest-database-sha256> \
77
77
  --confirm RESTORE_DATABASE_FROM_VERIFIED_BACKUP
@@ -84,9 +84,9 @@ veritabanı tüm kontrollerden geçmeden bunu silmeyin.
84
84
  ## Geri Yükleme Sonrası Doğrulama
85
85
 
86
86
  ```sh
87
- bunx --package @vaur94/agz-memory@0.4.0 agz-memory-admin doctor
88
- bunx --package @vaur94/agz-memory@0.4.0 agz-memory-admin capture status
89
- bunx --package @vaur94/agz-memory@0.4.0 agz-memory-admin outbox status
87
+ bunx --package @vaur94/agz-memory@0.5.0 agz-memory-admin doctor
88
+ bunx --package @vaur94/agz-memory@0.5.0 agz-memory-admin capture status
89
+ bunx --package @vaur94/agz-memory@0.5.0 agz-memory-admin outbox status
90
90
  ```
91
91
 
92
92
  Yalnız MCP sunucusunu başlatın ve salt-okunur `project_list`, `memory_recall` ve
@@ -94,6 +94,26 @@ Yalnız MCP sunucusunu başlatın ve salt-okunur `project_list`, `memory_recall`
94
94
  OpenCode'u ancak bu kontroller geçince yeniden başlatın. Ayrı devreye alma kararı
95
95
  verilene kadar eklentiyi `off` tutun.
96
96
 
97
+ ## Korunan Bakım Kapısı
98
+
99
+ `<database>.maintenance/owner.json` içindeki `state: recovery-required`, önceki
100
+ bir geri yüklemenin geri alma sonucunu doğrulayamadığını gösterir. Bu kapı
101
+ otomatik kaldırılmaz. Tüm MCP/eklenti süreçlerini durdurun; veritabanını, yan
102
+ dosyaları, kapıyı ve geri yükleme kalıntılarını koruyun; ardından doğrulanmış bir
103
+ yedek seçin. Kayıtlı tam sahip kimliğini yalnız geri yükleme komutunda verin:
104
+
105
+ ```sh
106
+ bunx --package @vaur94/agz-memory@0.5.0 agz-memory-admin restore <manifest> \
107
+ --sha256 <manifest-sha256> \
108
+ --confirm RESTORE_DATABASE_FROM_VERIFIED_BACKUP \
109
+ --maintenance-owner <owner-id> \
110
+ --maintenance-confirm RECOVER_RETAINED_MAINTENANCE_GATE
111
+ ```
112
+
113
+ Uzak, canlı, bozuk veya başka biçimde doğrulanamayan sahipler engelli kalır.
114
+ Kapıyı elle silmeyin; kurtarma geri yüklemesi kapı dizini kesintisiz yerindeyken
115
+ sahipliği atomik olarak devralır.
116
+
97
117
  ## Eski Geçiş Kilidi
98
118
 
99
119
  Kilit `<database>.migration.lock/owner.json` konumundadır. Kayıtlı süreç yaşıyor
@@ -103,7 +123,7 @@ Sahip dosyasındaki PID, makine ve başlangıç zamanını doğrulayın. Yalnız
103
123
  kanıtlanan kilidi tam sahip ID'si ve onayla kırın:
104
124
 
105
125
  ```sh
106
- bunx --package @vaur94/agz-memory@0.4.0 agz-memory-admin unlock \
126
+ bunx --package @vaur94/agz-memory@0.5.0 agz-memory-admin unlock \
107
127
  --owner <owner-id> \
108
128
  --confirm BREAK_STALE_MIGRATION_LOCK
109
129
  ```
@@ -116,14 +136,14 @@ kanıtıdır; veritabanı doğrulamasını atlama izni değildir.
116
136
  İlk komut silme yapmaz ve tam yedek kümesinin özetini döndürür:
117
137
 
118
138
  ```sh
119
- bunx --package @vaur94/agz-memory@0.4.0 agz-memory-admin backup prune
139
+ bunx --package @vaur94/agz-memory@0.5.0 agz-memory-admin backup prune
120
140
  ```
121
141
 
122
142
  Listelenen her manifest/veritabanı çiftini inceleyin. Yalnız değişmemiş kümeyi
123
143
  silin:
124
144
 
125
145
  ```sh
126
- bunx --package @vaur94/agz-memory@0.4.0 agz-memory-admin backup prune \
146
+ bunx --package @vaur94/agz-memory@0.5.0 agz-memory-admin backup prune \
127
147
  --digest <dry-run-digest> \
128
148
  --confirm DELETE_VERIFIED_BACKUPS
129
149
  ```
@@ -0,0 +1,125 @@
1
+ # Repository Hardening Checklist
2
+
3
+ Repository: `ugur-murat-alt/agz-memory`
4
+
5
+ Verified on: 2026-09-02
6
+
7
+ The checks below are GitHub repository controls and cannot be enforced by the package source alone. The verification performed for 0.5.0 found that `main` had no classic branch protection, no repository ruleset, no deployment environment, and Actions allowed all actions without repository-level SHA-pinning enforcement. Workflow actions in this repository are nevertheless pinned by commit SHA.
8
+
9
+ ## Required `main` Ruleset
10
+
11
+ GitHub screen: **Settings > Rules > Rulesets > New branch ruleset**
12
+
13
+ Target: default branch, `main`
14
+
15
+ Enable:
16
+
17
+ - Restrict deletions.
18
+ - Block force pushes.
19
+ - Require a pull request before merging.
20
+ - Require at least one approval.
21
+ - Dismiss stale approvals when new commits are pushed.
22
+ - Require review from Code Owners when a `CODEOWNERS` file is introduced.
23
+ - Require conversation resolution.
24
+ - Require status checks to pass.
25
+ - Require branches to be up to date before merging.
26
+ - Require signed commits.
27
+ - Require linear history.
28
+
29
+ Required status checks should include every 0.5.0 CI gate rather than only the aggregate job name:
30
+
31
+ - Linux minimum Bun type/test/build/package gate.
32
+ - Linux current Bun type/test/build/package gate.
33
+ - macOS current Bun gate.
34
+ - Windows current Bun gate.
35
+ - Property/security tests.
36
+ - Multiprocess stress tests.
37
+ - Restore fault tests.
38
+ - Benchmark gate.
39
+ - Packed install and audit.
40
+ - CodeQL.
41
+ - Dependency review for pull requests.
42
+
43
+ Do not grant bypass permission to ordinary contributors. Keep the repository administrator bypass limited to documented emergency recovery.
44
+
45
+ ## Signed Commits and Tags
46
+
47
+ GitHub screen: **Settings > Rules > Rulesets > Require signed commits**
48
+
49
+ Local verification:
50
+
51
+ ```sh
52
+ git log --show-signature -1
53
+ git tag -v v0.5.0
54
+ ```
55
+
56
+ Create the release tag from the reviewed merge commit. Do not move an existing release tag.
57
+
58
+ ## Release Environment
59
+
60
+ GitHub screen: **Settings > Environments > New environment**
61
+
62
+ Name: `npm-release`
63
+
64
+ Configure:
65
+
66
+ - Required reviewer.
67
+ - Deployment branch restricted to protected `main` and version tags.
68
+ - No long-lived npm token when trusted publishing is available.
69
+
70
+ The publish workflow should use npm trusted publishing with OpenID Connect and provenance:
71
+
72
+ ```yaml
73
+ permissions:
74
+ contents: read
75
+ id-token: write
76
+ ```
77
+
78
+ ```sh
79
+ npm publish --provenance --access public
80
+ ```
81
+
82
+ Verify the published package exposes provenance and that npm `gitHead`, Git tag SHA, GitHub Release SHA, and reviewed merge commit all match.
83
+
84
+ ## Actions Policy
85
+
86
+ GitHub screen: **Settings > Actions > General > Actions permissions**
87
+
88
+ Prefer **Allow enterprise actions and select non-enterprise actions** if the account plan supports it. Require full-length commit SHA pinning for third-party actions. Keep workflow token permissions read-only by default and grant narrower write permissions per job.
89
+
90
+ Repository verification commands:
91
+
92
+ ```sh
93
+ gh api repos/ugur-murat-alt/agz-memory/branches/main/protection
94
+ gh api repos/ugur-murat-alt/agz-memory/rulesets
95
+ gh api repos/ugur-murat-alt/agz-memory/actions/permissions
96
+ gh api repos/ugur-murat-alt/agz-memory/environments
97
+ ```
98
+
99
+ Expected release condition:
100
+
101
+ - The protection endpoint or active ruleset reports required pull requests, reviews, signed commits, required status checks, no force push, and no deletion.
102
+ - At least one protected `npm-release` environment exists.
103
+ - Actions policy and workflow files both enforce immutable action versions.
104
+
105
+ ## npm Package Policy
106
+
107
+ - Enable npm two-factor authentication for authorization and writes.
108
+ - Enable trusted publishing for both `@vaur94/agz-memory` and `@vaur94/agz-memory-plugin`.
109
+ - Require provenance on both packages.
110
+ - Deprecate, do not overwrite, a compromised version.
111
+ - Test the packed artifacts together in a clean directory before publish.
112
+ - Verify registry integrity, package contents, imports, exact nine-tool MCP catalog, and inert plugin defaults after publish.
113
+
114
+ ## Release Evidence
115
+
116
+ Attach or link:
117
+
118
+ - Ruleset export or settings screenshots.
119
+ - Required-check list and successful run URLs.
120
+ - Signed merge commit and tag verification.
121
+ - Release environment protection.
122
+ - npm provenance statement for both packages.
123
+ - Pack SHA-256 values and clean-install smoke output.
124
+
125
+ Repository setting changes remain a release blocker until independently verified. Source documentation does not itself close AGZ-064.
@@ -0,0 +1,78 @@
1
+ # AGZ 0.5.0 Review Resolution
2
+
3
+ This record maps every AGZ-001 through AGZ-068 review finding to its 0.5.0
4
+ resolution and durable source or regression evidence. `Fixed` means the source
5
+ change and cited local test or release gate exist in this branch. Repository
6
+ settings are external state; AGZ-064 remains explicitly deferred and blocks a
7
+ release-ready claim until the controls in `repository-hardening.md` are verified.
8
+
9
+ | Finding | Priority | Resolution | Evidence |
10
+ |---|---|---|---|
11
+ | AGZ-001 | P1 | Fixed | Note update and pin compare-and-swap under multiprocess contention: `src/store.ts`, `test/concurrency/note-update-multiprocess.test.ts`. |
12
+ | AGZ-002 | P1 | Fixed | Project deletion binds the immutable ID and confirmed current name in one transaction: `src/store.ts`, `test/concurrency/project-delete-rename.test.ts`. |
13
+ | AGZ-003 | P1 | Fixed | Revision snapshots and provenance use the row returned by the successful mutation: `src/store.ts`, `test/store/lifecycle.test.ts`. |
14
+ | AGZ-004 | P1 | Fixed | Required outbox insertion shares the canonical transaction and cannot be ignored: `src/store.ts`, `test/store/lifecycle.test.ts`. |
15
+ | AGZ-005 | P1 | Fixed | Concurrent project and binding creation distinguishes duplicates from conflicts: `src/store.ts`, `src/store/capture.ts`, `test/concurrency/binding-race.test.ts`. |
16
+ | AGZ-006 | P1 | Fixed | Domain-separated, length-prefixed UTF-8 tuple hashing removes delimiter and Unicode collisions: `src/hash.ts`, `test/capture/capture-contract-v2.test.ts`. |
17
+ | AGZ-007 | P1 | Fixed | Reused capture identities with different source or payload fail as `idempotency_conflict`: `src/store/capture.ts`, `test/capture/capture-contract-v2.test.ts`. |
18
+ | AGZ-008 | P1 | Fixed | Shared MCP/core identities retain the exact nine-tool and fail-closed contract: `src/tools.ts`, `test/contract/mcp-surface.test.ts`. |
19
+ | AGZ-009 | P1 | Fixed | Normal handles publish lifetime database leases before opening SQLite: `src/db/maintenance.ts`, `test/db/maintenance.test.ts`. |
20
+ | AGZ-010 | P1 | Fixed | Maintenance uses one exclusive gate and rejects active or unverifiable handles: `src/db/maintenance.ts`, `test/db/maintenance.test.ts`. |
21
+ | AGZ-011 | P1 | Fixed | Restore refuses to replace a database held by a live writer: `src/db/backup.ts`, `test/db/restore-live-writer.test.ts`. |
22
+ | AGZ-012 | P1 | Fixed | Restore copies and hashes one opened source inode instead of reopening a verified path: `src/db/backup.ts`, `test/db/restore-toctou.test.ts`. |
23
+ | AGZ-013 | P1 | Fixed | Database, backup, sidecar, gate, lease, and manifest paths reject symbolic links: `src/db/maintenance.ts`, `src/db/backup.ts`, `test/db/path-symlink-matrix.test.ts`. |
24
+ | AGZ-014 | P1 | Fixed | `application_id` and `agz_meta` bind product, database UUID, schema, and hash policy: `src/db/schema.ts`, `docs/schema-v11.md`. |
25
+ | AGZ-015 | P1 | Fixed | Exact application-object fingerprint detects same-version schema drift: `src/db/schema.ts`, `test/db/schema-drift-failclosed.test.ts`. |
26
+ | AGZ-016 | P1 | Fixed | Nonempty unsigned databases fail closed while a zero-object database may initialize: `src/db.ts`, `test/db/unrecognized-database.test.ts`. |
27
+ | AGZ-017 | P1 | Fixed | Projection reports truncation into the redaction boundary instead of hiding removed suffixes: `src/capture/projection.ts`, `test/security/redaction-property.test.ts`. |
28
+ | AGZ-018 | P1 | Fixed | Credential/private-key/high-entropy redaction fails closed across boundaries and punctuation: `src/capture/redact.ts`, `test/security/redaction-corpus.test.ts`. |
29
+ | AGZ-019 | P1 | Fixed | Capture event kinds enforce required and forbidden native source identity fields: `src/capture/contract.ts`, `test/capture/capture-contract-v2.test.ts`. |
30
+ | AGZ-020 | P1 | Fixed | Composite foreign keys reject cross-project binding, capture, checkpoint, note, and outbox references: `src/db/schema.ts`, `test/capture/capture-contract-v2.test.ts`. |
31
+ | AGZ-021 | P1 | Fixed | Quarantined events retain no payload and cannot materialize notes: `src/store/capture.ts`, `test/capture/capture.test.ts`. |
32
+ | AGZ-022 | P1 | Fixed | Extraction admits terminal text/status only and excludes tool payloads and reasoning: `packages/opencode-plugin/src/extract.ts`, `test/capture/capture.test.ts`. |
33
+ | AGZ-023 | P1 | Fixed | Checkpoints use `(binding_key, session_id)` so native session IDs can repeat safely: `src/db/schema.ts`, `test/capture/capture-contract-v2.test.ts`. |
34
+ | AGZ-024 | P1 | Fixed | Startup/hourly retention drains bounded terminal, quarantined, and checkpoint backlogs: `src/store/capture.ts`, `test/capture/capture.test.ts`. |
35
+ | AGZ-025 | P2 | Fixed | Reconciliation resumes only after the persisted binding/session checkpoint: `packages/opencode-plugin/src/runtime.ts`, `test/plugin/reconcile-incremental.test.ts`. |
36
+ | AGZ-026 | P2 | Fixed | Reconciliation has bounded global concurrency and coalesces same-session reruns: `packages/opencode-plugin/src/runtime.ts`, `test/plugin/reconcile-backpressure.test.ts`. |
37
+ | AGZ-027 | P1 | Fixed | Shutdown aborts without awaiting hung event, session, or context calls: `packages/opencode-plugin/src/runtime.ts`, `test/plugin/hung-context-stop.test.ts`. |
38
+ | AGZ-028 | P1 | Fixed | Turn opt-out remains effective across every supported hook order: `packages/opencode-plugin/src/runtime.ts`, `test/plugin/optout-hook-permutations.test.ts`. |
39
+ | AGZ-029 | P2 | Fixed | Concurrent opt-out history probes share one bounded request: `packages/opencode-plugin/src/runtime.ts`, `test/plugin/optout-hook-permutations.test.ts`. |
40
+ | AGZ-030 | P2 | Fixed | Reconciliation, terminal-event, and opt-out preflight calls have bounded abortable timeouts: `packages/opencode-plugin/src/runtime.ts`, `packages/opencode-plugin/test/plugin.test.ts`. |
41
+ | AGZ-031 | P2 | Fixed | Runtime errors are reduced to safe codes and do not log payload text: `packages/opencode-plugin/src/runtime.ts`, `packages/opencode-plugin/test/plugin.test.ts`. |
42
+ | AGZ-032 | P1 | Fixed | Location and binding checks fail closed on missing, mismatched, or conflicting identity: `packages/opencode-plugin/src/binding.ts`, `packages/opencode-plugin/test/plugin.test.ts`. |
43
+ | AGZ-033 | P2 | Fixed | First run creates the private default database hierarchy below `HOME`: `src/config.ts`, `test/plugin/first-run-home.test.ts`. |
44
+ | AGZ-034 | P1 | Fixed | Injection remains bounded, escaped, and explicitly marked untrusted: `src/retrieval/formatter.ts`, `test/retrieval/retrieval.test.ts`. |
45
+ | AGZ-035 | P1 | Fixed | Plugin defaults remain off/empty and exact OpenCode version mismatch disables startup: `packages/opencode-plugin/src/config.ts`, `packages/opencode-plugin/test/plugin.test.ts`. |
46
+ | AGZ-036 | P1 | Fixed | Backend hits use the redacted derived-document hash, not canonical note hash: `src/retrieval/derived.ts`, `test/retrieval/hardening.test.ts`. |
47
+ | AGZ-037 | P1 | Fixed | Backend responses have strict keys/types/count bounds and malformed data falls back lexically: `src/retrieval/contract.ts`, `test/retrieval/hardening.test.ts`. |
48
+ | AGZ-038 | P2 | Fixed | One deadline covers backend, canonical validation, graph expansion, and formatting: `src/store/retrieval.ts`, `test/retrieval/hardening.test.ts`. |
49
+ | AGZ-039 | P2 | Fixed | Backend hit validation uses bounded batch SQL rather than per-hit queries: `src/store/retrieval.ts`, `test/retrieval/hardening.test.ts`. |
50
+ | AGZ-040 | P2 | Fixed | Reciprocal-rank fusion is deterministic under channel permutation: `src/retrieval/fusion.ts`, `test/retrieval/hardening.test.ts`. |
51
+ | AGZ-041 | P1 | Fixed | Directed graph retrieval preserves source and target endpoints: `src/store/retrieval.ts`, `test/retrieval/hardening.test.ts`. |
52
+ | AGZ-042 | P2 | Fixed | Context truncation never splits a Unicode code point: `src/retrieval/formatter.ts`, `test/retrieval/hardening.test.ts`. |
53
+ | AGZ-043 | P1 | Fixed | Stale and cross-project backend hits are rejected against canonical rows: `src/store/retrieval.ts`, `test/retrieval/retrieval.test.ts`. |
54
+ | AGZ-044 | P1 | Fixed | Outbox backend calls hard-time out even when `AbortSignal` is ignored: `src/store/outbox.ts`, `test/retrieval/hardening.test.ts`. |
55
+ | AGZ-045 | P1 | Fixed | Heartbeat, lease generation, and fence condition every final outbox transition: `src/store/outbox.ts`, `test/retrieval/hardening.test.ts`. |
56
+ | AGZ-046 | P1 | Fixed | Operation-specific checks and tuple-hashed operation keys reject malformed queue rows: `src/db/schema.ts`, `src/store/outbox.ts`, `test/store/outbox.test.ts`. |
57
+ | AGZ-047 | P1 | Fixed | Each reindex generation queues purge plus a transactional active-note snapshot: `src/admin/index.ts`, `test/retrieval/hardening.test.ts`. |
58
+ | AGZ-048 | P2 | Fixed | Dead work retries explicitly and bounded exponential backoff preserves FIFO: `src/admin/index.ts`, `src/store/outbox.ts`, `test/store/outbox.test.ts`. |
59
+ | AGZ-049 | P1 | Fixed | Project deletion and rebuild enqueue purge so derived stores cannot retain omitted content: `src/store.ts`, `src/admin/index.ts`, `test/store/outbox.test.ts`. |
60
+ | AGZ-050 | P1 | Fixed | Backup publication and migration occur only under the maintenance gate with verified rollback: `src/db.ts`, `src/db/backup.ts`, `test/db/maintenance.test.ts`, `test/db/backup-restore.test.ts`. |
61
+ | AGZ-051 | P2 | Fixed | Batch mutations remain ordered, independently committed, and return every result: `src/tools.ts`, `test/contract/mcp-surface.test.ts`. |
62
+ | AGZ-052 | P1 | Fixed | Schema-10 migration preserves valid legacy bindings, events, tombstones, and orphaned outbox history: `src/db/migrations/v011.ts`, `test/db/migration-v11.test.ts`. |
63
+ | AGZ-053 | P1 | Fixed | Migration verifies counts, revisions, hashes, FTS, foreign keys, identity, and fingerprint before publish: `src/db/migrations/v011.ts`, `src/admin/doctor.ts`, `test/db/migration-v11.test.ts`. |
64
+ | AGZ-054 | P2 | Fixed | Public query and batch inputs retain explicit hard cardinality bounds: `src/tools.ts`, `test/contract/mcp-surface.test.ts`. |
65
+ | AGZ-055 | P1 | Fixed | Semantic query bytes and retrieval card requests clamp to hard limits: `src/store/retrieval.ts`, `test/retrieval/hardening.test.ts`. |
66
+ | AGZ-056 | P2 | Fixed | Store conflicts and lease loss return stable typed error codes rather than raw SQLite errors: `src/store.ts`, `src/store/outbox.ts`, concurrency regressions. |
67
+ | AGZ-057 | P1 | Fixed | Doctor checks database identity, exact fingerprint, tenant references, hashes, revisions, FTS, and operation keys: `src/admin/doctor.ts`, `test/db/migration-v11.test.ts`. |
68
+ | AGZ-058 | P2 | Fixed | Admin reindex/status/retry responses are bounded and payload-free: `src/admin/index.ts`, `test/retrieval/hardening.test.ts`. |
69
+ | AGZ-059 | P2 | Fixed | Retrieval metrics deduplicate rankings and clamp recall, MRR, and NDCG to the unit interval: `benchmark/evaluate.ts`, `test/retrieval/hardening.test.ts`. |
70
+ | AGZ-060 | P2 | Fixed | `benchmark:gate` enforces the documented p99 latency ceiling: `benchmark/run.ts`, `package.json`. |
71
+ | AGZ-061 | P3 | Fixed | Baseline manifest, timings, logs, platform, commit, and benchmark artifacts are committed in `artifacts/baseline/manifest.json` and its listed files. |
72
+ | AGZ-062 | P2 | Fixed | CI covers minimum/current Bun on Linux plus current Bun on macOS and Windows: `.github/workflows/ci.yml`. |
73
+ | AGZ-063 | P2 | Fixed | CI has separate property, stress, restore, benchmark, CodeQL, and dependency-review gates with immutable action pins: `.github/workflows/ci.yml`. |
74
+ | AGZ-064 | P2 | Deferred | `main` protection/ruleset and `npm-release` environment are absent external repository settings; required controls and verification are in `docs/repository-hardening.md`. |
75
+ | AGZ-065 | P2 | Fixed | Package smoke derives both tarball names from the manifest version instead of a stale literal: `.github/workflows/ci.yml`. |
76
+ | AGZ-066 | P3 | Fixed | Runtime ranges, exact plugin compatibility, frozen lock installs, audits, and Dependabot policy are explicit: `package.json`, `packages/opencode-plugin/package.json`, `.github/dependabot.yml`. |
77
+ | AGZ-067 | P3 | Fixed | English/Turkish README and recovery sections are release-verified as mapped contracts: `scripts/verify-release.ts`, `test/release/release-surface.test.ts`. |
78
+ | AGZ-068 | P2 | Fixed | Release verification requires exactly this ordered 68-row record and forbids deferred P0/P1 findings: `scripts/verify-release.ts`, `test/release/release-surface.test.ts`. |
@@ -0,0 +1,75 @@
1
+ # SQLite Schema 11
2
+
3
+ Schema 11 is the canonical storage contract for AGZ Memory 0.5.0. SQLite remains the source of truth. Search backends are derived, redacted, disposable indexes rebuilt through the durable outbox.
4
+
5
+ ## Database Identity
6
+
7
+ - `PRAGMA application_id` is the AGZ Memory application identifier.
8
+ - `agz_meta` contains exactly one row with the database UUID, product identifier, schema version, schema fingerprint, hash policy, and creation time.
9
+ - `schema_state` contains exactly one row with version `11`.
10
+ - A zero-object SQLite database can be initialized. A nonempty unsigned database is rejected by normal open.
11
+ - Existing schema 11 databases are verified, not repaired. Missing, changed, or unexpected application objects fail with `schema_fingerprint_mismatch`.
12
+
13
+ ## Hash Policy
14
+
15
+ All new persisted hashes use the version 2 tuple encoder described in [`adr/hash-identity-v2.md`](adr/hash-identity-v2.md). Canonical note hashes and derived-document hashes use separate domains. A derived backend hit is valid only when its revision and derived hash match a fresh `deriveDocument()` result from the same active project note.
16
+
17
+ ## Tenant Constraints
18
+
19
+ - Notes and edges retain composite project foreign keys.
20
+ - `notes(project_id, supersedes_id)` references `notes(project_id, id)` with `ON DELETE RESTRICT`. A referenced superseded note must not be deleted until the relationship is explicitly resolved.
21
+ - `project_bindings(binding_key, project_id)` is a composite parent key.
22
+ - Capture events and checkpoints use the binding/project composite foreign key.
23
+ - Checkpoints are identified by `(binding_key, session_id)`, so native session IDs may repeat under independent bindings.
24
+
25
+ ## Capture Contract
26
+
27
+ The schema 11 writer stores `agz-memory.capture/2` events. Event identities are strict:
28
+
29
+ | Kind | Required identity | Forbidden identity |
30
+ |---|---|---|
31
+ | user candidate | message ID | ordinal, tool call, terminal status |
32
+ | assistant candidate | message ID and ordinal | tool call, terminal status |
33
+ | tool signal | message ID, tool call ID, terminal status | ordinal |
34
+ | session summary | checkpoint message ID | ordinal, tool call, terminal status |
35
+
36
+ Ingestion recomputes the idempotency key. An identical retry is `duplicate`; a reused key with different source or payload is `idempotency_conflict`.
37
+
38
+ ## Revision and Mutation Invariants
39
+
40
+ - A note's `current_revision` is monotonically increasing.
41
+ - Updates and pin changes use optimistic compare-and-swap: `UPDATE ... WHERE current_revision = ? RETURNING *`.
42
+ - A retry reloads the current row and reapplies the original patch.
43
+ - The returned row is the only source for revision snapshots, provenance, derived hashes, and outbox generation.
44
+ - Revision/provenance/outbox insertion happens in the same immediate transaction as the canonical mutation.
45
+ - A canonical commit never depends on backend availability. A required outbox insertion cannot be silently ignored.
46
+ - Manual title or kind changes clear `subject_key`; manual edits must not retain an automatic capture identity for a changed subject.
47
+
48
+ ## Outbox
49
+
50
+ Schema 11 adds operation identity, reindex generation, lease generation/fence, and heartbeat fields. Operation-specific checks require:
51
+
52
+ - `upsert-note`: note ID, positive revision, and derived SHA-256.
53
+ - `delete-note`: note ID and positive revision; no document payload.
54
+ - `purge-project`: no note ID, revision, or content hash.
55
+
56
+ Partial unique indexes prevent duplicate active upsert, delete, purge, and reindex-generation operations without allowing historical terminal rows to block a new rebuild. Backends receive an idempotency operation key and monotonically increasing fence. Lease heartbeat and final state transitions are owner/fence conditional; zero changed rows is `lost_lease`.
57
+
58
+ ## Reindex
59
+
60
+ Each reindex command transactionally creates a new generation of durable outbox operations. Every selected project queues one purge before its bounded active-note upserts. Progress is represented by the persisted outbox states. A repeated reindex uses a new generation and is not blocked by old succeeded rows. Quarantined derived documents are omitted after purge and counted by reason code.
61
+
62
+ ## Migration From Schema 10
63
+
64
+ Before migration, AGZ Memory creates and verifies one source-schema-10 backup while holding the maintenance gate. Migration then:
65
+
66
+ 1. Validates source health, tenant relationships, supersession references, capture source identities, and outbox rows.
67
+ 2. Builds schema 11 replacement tables.
68
+ 3. Recomputes version 2 canonical, revision, derived, binding, payload, event, checkpoint, and outbox identities.
69
+ 4. Records aggregate old/new mapping counts without private content.
70
+ 5. Verifies row counts, foreign keys, current-revision agreement, hashes, FTS, application identity, and the exact schema fingerprint.
71
+ 6. Publishes version 11 only after all checks pass.
72
+
73
+ Cross-project, malformed, or ambiguous legacy rows stop migration. Documented compatibility normalization resets checkpoint watermarks, canonicalizes retained payloadless capture identities, and repairs valid historical outbox tombstone fields without dropping rows. The error identifies only the safe table/row identity and an error code; the verified backup path is included in the operator-facing migration report.
74
+
75
+ Reopening a valid schema 11 database is idempotent and does not execute `CREATE IF NOT EXISTS`. A 0.4.1 binary observes version 11 and rejects it as newer before writing application DDL.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaur94/agz-memory",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Project-scoped persistent linked memory MCP server for OpenCode V2",
5
5
  "type": "module",
6
6
  "main": "./dist/server.js",
@@ -18,6 +18,8 @@
18
18
  "files": [
19
19
  "README.md",
20
20
  "README.tr.md",
21
+ "skills/index.json",
22
+ "skills/agz-memory/agz-memory.md",
21
23
  "dist/server.js",
22
24
  "dist/core.js",
23
25
  "dist/admin.js",
@@ -26,14 +28,22 @@
26
28
  "CHANGELOG.md",
27
29
  "docs/backup-restore-runbook.md",
28
30
  "docs/backup-restore-runbook.tr.md",
31
+ "docs/schema-v11.md",
32
+ "docs/review-resolution.md",
33
+ "docs/repository-hardening.md",
34
+ "docs/adr/*.md",
29
35
  "LICENSE"
30
36
  ],
31
37
  "scripts": {
32
38
  "types": "rm -rf dist/types && bunx tsc -p tsconfig.build.json",
33
39
  "build": "rm -rf dist && bun build src/index.ts --target bun --format esm --packages external --outfile dist/server.js && bun build src/core.ts --target bun --format esm --packages external --outfile dist/core.js && bun build src/admin/index.ts --target bun --format esm --packages external --outfile dist/admin.js && bunx tsc -p tsconfig.build.json && bun run --cwd packages/opencode-plugin build",
34
- "check": "bunx tsc --noEmit && bun run types && bun run --cwd packages/opencode-plugin check",
35
- "test": "bun test",
40
+ "check": "bun run types && bunx tsc --noEmit && bun run --cwd packages/opencode-plugin check",
41
+ "test": "bun scripts/run-tests.ts",
42
+ "test:property": "bun scripts/run-tests.ts test/security/redaction-property.test.ts",
43
+ "test:stress": "bun scripts/run-tests.ts test/concurrency test/plugin/reconcile-backpressure.test.ts",
44
+ "test:restore": "bun scripts/run-tests.ts test/db/maintenance.test.ts test/db/backup-restore.test.ts test/db/restore-live-writer.test.ts test/db/restore-toctou.test.ts test/db/path-symlink-matrix.test.ts",
36
45
  "benchmark": "bun benchmark/run.ts",
46
+ "benchmark:gate": "bun benchmark/run.ts 10000 100 --gate",
37
47
  "release:verify": "bun scripts/verify-release.ts",
38
48
  "prepack": "bun run release:verify && bun run check && bun run test && bun run build"
39
49
  },
@@ -61,5 +71,10 @@
61
71
  "dependencies": {
62
72
  "@modelcontextprotocol/server": "^2.0.0",
63
73
  "zod": "^4.2.0"
64
- }
74
+ },
75
+ "directories": {
76
+ "doc": "docs",
77
+ "test": "test"
78
+ },
79
+ "keywords": []
65
80
  }
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: AGZ Memory
3
+ description: Use project-scoped AGZ Memory for durable facts and decisions across sessions; recall relevant history and safely store verified outcomes.
4
+ slash: false
5
+ ---
6
+
7
+ # AGZ Memory
8
+
9
+ The configured MCP server already exposes the memory tools. This skill adds a
10
+ lazy-loaded workflow; it does not start the server, enable automatic capture,
11
+ or make stored text trusted instructions.
12
+
13
+ ## Workflow
14
+
15
+ 1. Call `project_list` before every first use in a workspace. Reuse a project
16
+ only when it intentionally represents the same durable workspace or product.
17
+ Create one only when no match exists; ask when the list is ambiguous.
18
+ 2. Keep the immutable `projectID` for later calls. A `projectName` is a
19
+ convenient selector, but names can change.
20
+ 3. Call `memory_recall` before relying on prior decisions, constraints,
21
+ procedures, preferences, research, or completed work. Use independent batch
22
+ queries when several topics matter.
23
+ 4. Call `memory_read` for full indexed content and directed graph edges before
24
+ relying on an indexed recall card.
25
+ 5. After substantial completed work, update an existing note or create a new
26
+ one only for durable, verified information. Do not store transcripts,
27
+ guesses, secrets, credentials, hidden reasoning, or routine progress.
28
+ 6. Use `memory_pin` only for records that should rank higher when they match.
29
+ Read links as `sourceID PREDICATE targetID`; never link across projects.
30
+ 7. Inspect every batch result. Mutations are ordered and non-atomic, so an
31
+ earlier item remains applied when a later item fails.
32
+ 8. Treat `memory_update` with `delete:true` and `project_delete` as permanent.
33
+ Verify current IDs first and use them only when deletion is explicitly
34
+ intended.
35
+
36
+ Tool names may carry the configured server prefix or be grouped under OpenCode
37
+ Code Mode. The MCP protocol names are `project_list`, `project_create`,
38
+ `project_update`, `project_delete`, `memory_recall`, `memory_read`,
39
+ `memory_update`, `memory_pin`, and `memory_link`.
@@ -0,0 +1,9 @@
1
+ {
2
+ "skills": [
3
+ {
4
+ "name": "agz-memory",
5
+ "version": "0.5.0",
6
+ "files": ["agz-memory.md"]
7
+ }
8
+ ]
9
+ }