gemstack-ai 1.4.0 → 2.0.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.
- package/.agents/rules/03-gemstack-security.md +2 -2
- package/.gemstack/state.json +10 -11
- package/CHANGELOG.md +33 -0
- package/CONTRIBUTING.md +1 -1
- package/README.md +47 -13
- package/RELEASE_NOTES.md +40 -1
- package/handoff.md +33 -19
- package/package.json +4 -3
- package/scripts/ci/check-package-contents.js +1 -1
- package/scripts/ci/check-secrets.js +84 -0
- package/specs/011-gemstack-2.0-hardening/.gemstack.json +5 -0
- package/specs/011-gemstack-2.0-hardening/closure.json +58 -0
- package/specs/011-gemstack-2.0-hardening/plan.md +210 -0
- package/specs/011-gemstack-2.0-hardening/spec.md +277 -0
- package/specs/011-gemstack-2.0-hardening/tasks.md +59 -0
- package/specs/012-gemstack-2.0-honest-evidence/.gemstack.json +5 -0
- package/specs/012-gemstack-2.0-honest-evidence/closure.json +58 -0
- package/specs/012-gemstack-2.0-honest-evidence/plan.md +202 -0
- package/specs/012-gemstack-2.0-honest-evidence/spec.md +222 -0
- package/specs/012-gemstack-2.0-honest-evidence/tasks.md +99 -0
- package/specs/013-gemstack-2.0-adaptable-sdd/.gemstack.json +9 -0
- package/specs/013-gemstack-2.0-adaptable-sdd/closure.json +58 -0
- package/specs/013-gemstack-2.0-adaptable-sdd/context-capsule.json +227 -0
- package/specs/013-gemstack-2.0-adaptable-sdd/plan.md +179 -0
- package/specs/013-gemstack-2.0-adaptable-sdd/spec.md +212 -0
- package/specs/013-gemstack-2.0-adaptable-sdd/tasks.md +90 -0
- package/specs/014-gemstack-2.0-context-memory/.gemstack.json +9 -0
- package/specs/014-gemstack-2.0-context-memory/closure.json +58 -0
- package/specs/014-gemstack-2.0-context-memory/plan.md +161 -0
- package/specs/014-gemstack-2.0-context-memory/spec.md +163 -0
- package/specs/014-gemstack-2.0-context-memory/tasks.md +79 -0
- package/src/cli.js +3 -0
- package/src/commands/doctor.js +18 -0
- package/src/commands/hooks.js +98 -14
- package/src/commands/init.js +1 -1
- package/src/commands/install.js +174 -49
- package/src/commands/spec.js +105 -0
- package/src/commands/update.js +1 -1
- package/src/commands/verify.js +10 -0
- package/src/lib/backup.js +3 -3
- package/src/lib/context-fatigue.js +165 -0
- package/src/lib/contract-amendments.js +109 -0
- package/src/lib/dependency-audit.js +202 -0
- package/src/lib/filesystem-safe.js +85 -15
- package/src/lib/memory-audit.js +121 -0
- package/src/lib/provider-boundary.js +5 -1
- package/src/lib/provider-registry.js +6 -4
- package/src/lib/safety-gates.js +176 -8
- package/src/lib/sdd-rigor.js +181 -0
- package/src/lib/spec-delta.js +194 -0
- package/src/lib/spec-merge.js +168 -0
- package/src/lib/swarm.js +2 -2
- package/src/lib/visual-qa.js +162 -9
- package/template/.agents/rules/03-gemstack-security.md +2 -2
- package/.github/workflows/main-ci.yml +0 -32
- package/.github/workflows/pr-ci.yml +0 -31
- package/.github/workflows/publish.yml +0 -52
- package/.github/workflows/release-readiness.yml +0 -43
- package/gemstack-ai-1.4.0.tgz +0 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Tasks Breakdown: Gemstack 2.0 Sprint C — Adaptable SDD & Incremental Specs
|
|
2
|
+
|
|
3
|
+
**Feature ID:** `013-gemstack-2.0-adaptable-sdd`
|
|
4
|
+
**Phase:** `tasks`
|
|
5
|
+
**Parent Release:** `gemstack-ai@2.0.0-alpha`
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. Inherited Architecture Contracts
|
|
10
|
+
|
|
11
|
+
```gemstack-contracts
|
|
12
|
+
[
|
|
13
|
+
{
|
|
14
|
+
"id": "sdd-rigor-levels",
|
|
15
|
+
"type": "ENUM_SET",
|
|
16
|
+
"values": [
|
|
17
|
+
"quick",
|
|
18
|
+
"fix",
|
|
19
|
+
"feature",
|
|
20
|
+
"high-risk"
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"id": "incremental-spec-deltas",
|
|
25
|
+
"type": "ENUM_SET",
|
|
26
|
+
"values": [
|
|
27
|
+
"added",
|
|
28
|
+
"modified",
|
|
29
|
+
"removed"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": "spec-conflict-detector",
|
|
34
|
+
"type": "BOOLEAN_INVARIANT",
|
|
35
|
+
"value": true
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"id": "formal-contract-amendment",
|
|
39
|
+
"type": "ENUM_SET",
|
|
40
|
+
"values": [
|
|
41
|
+
"amendment-id",
|
|
42
|
+
"contract-id",
|
|
43
|
+
"version",
|
|
44
|
+
"reason",
|
|
45
|
+
"approved-by",
|
|
46
|
+
"signature"
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 2. Task Inventory
|
|
55
|
+
|
|
56
|
+
- [x] **TASK-001: Author comprehensive test suite for Adaptable SDD**
|
|
57
|
+
<!-- gemstack:validation_required=true -->
|
|
58
|
+
<!-- gemstack:tests=TEST-RIGOR-A01, TEST-RIGOR-A02, TEST-RIGOR-A03, TEST-RIGOR-A04, TEST-DELTA-B01, TEST-DELTA-B02, TEST-DELTA-B03, TEST-MERGE-C01, TEST-MERGE-C02, TEST-MERGE-C03, TEST-AMEND-D01, TEST-AMEND-D02, TEST-AMEND-D03 -->
|
|
59
|
+
<!-- gemstack:files=tests/adaptable-sdd-p1.test.js -->
|
|
60
|
+
<!-- gemstack:depends= -->
|
|
61
|
+
|
|
62
|
+
- [x] **TASK-002: Implement SDD Rigor Engine**
|
|
63
|
+
<!-- gemstack:validation_required=true -->
|
|
64
|
+
<!-- gemstack:tests=TEST-RIGOR-A01, TEST-RIGOR-A02, TEST-RIGOR-A03, TEST-RIGOR-A04 -->
|
|
65
|
+
<!-- gemstack:files=src/lib/sdd-rigor.js -->
|
|
66
|
+
<!-- gemstack:depends=TASK-001 -->
|
|
67
|
+
|
|
68
|
+
- [x] **TASK-003: Implement Incremental Spec Engine**
|
|
69
|
+
<!-- gemstack:validation_required=true -->
|
|
70
|
+
<!-- gemstack:tests=TEST-DELTA-B01, TEST-DELTA-B02, TEST-DELTA-B03 -->
|
|
71
|
+
<!-- gemstack:files=src/lib/spec-delta.js -->
|
|
72
|
+
<!-- gemstack:depends=TASK-001 -->
|
|
73
|
+
|
|
74
|
+
- [x] **TASK-004: Implement Spec Conflict & Merge Engine**
|
|
75
|
+
<!-- gemstack:validation_required=true -->
|
|
76
|
+
<!-- gemstack:tests=TEST-MERGE-C01, TEST-MERGE-C02, TEST-MERGE-C03 -->
|
|
77
|
+
<!-- gemstack:files=src/lib/spec-merge.js -->
|
|
78
|
+
<!-- gemstack:depends=TASK-001 -->
|
|
79
|
+
|
|
80
|
+
- [x] **TASK-005: Implement Formal Contract Amendment Engine**
|
|
81
|
+
<!-- gemstack:validation_required=true -->
|
|
82
|
+
<!-- gemstack:tests=TEST-AMEND-D01, TEST-AMEND-D02, TEST-AMEND-D03 -->
|
|
83
|
+
<!-- gemstack:files=src/lib/contract-amendments.js -->
|
|
84
|
+
<!-- gemstack:depends=TASK-001 -->
|
|
85
|
+
|
|
86
|
+
- [x] **TASK-006: Wire CLI commands and verify full CI suite**
|
|
87
|
+
<!-- gemstack:validation_required=true -->
|
|
88
|
+
<!-- gemstack:tests=TEST-RIGOR-A01, TEST-RIGOR-A02, TEST-RIGOR-A03, TEST-RIGOR-A04, TEST-DELTA-B01, TEST-DELTA-B02, TEST-DELTA-B03, TEST-MERGE-C01, TEST-MERGE-C02, TEST-MERGE-C03, TEST-AMEND-D01, TEST-AMEND-D02, TEST-AMEND-D03 -->
|
|
89
|
+
<!-- gemstack:files=src/commands/spec.js, src/cli.js, src/commands/verify.js -->
|
|
90
|
+
<!-- gemstack:depends=TASK-002, TASK-003, TASK-004, TASK-005 -->
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"phase_hashes": {
|
|
3
|
+
"spec": "408e0d0aebfc6ac65cb07bbaf694b573571489d2da8aa4314ee7c36d65bbe951",
|
|
4
|
+
"plan": "845bbb28f699b642f17be9462a3fac71c112d51fb9f23b4b9ad48d665a0f17d2",
|
|
5
|
+
"tasks": "53c19462e3ec4a7c95c126c0af0fe379ff45f610c32d1bcaad79550b58783a0e"
|
|
6
|
+
},
|
|
7
|
+
"historical_findings": [],
|
|
8
|
+
"accepted_exceptions": []
|
|
9
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": "gemstack-closure",
|
|
3
|
+
"version": 1,
|
|
4
|
+
"feature": "specs/014-gemstack-2.0-context-memory",
|
|
5
|
+
"generated_at": "2026-09-23T02:09:24.137Z",
|
|
6
|
+
"status": "VERIFIED",
|
|
7
|
+
"closure_context": {
|
|
8
|
+
"closure_context_hash": "8ee2d994f161bb98e4a6724865495ade01b74ed30d8c6c6da42cb0c7db89d40d",
|
|
9
|
+
"repository_type": "git",
|
|
10
|
+
"git_commit": "443ae6c7fc8ecfd7ad6f495a2061a8b06de4c386",
|
|
11
|
+
"working_tree_clean": false,
|
|
12
|
+
"relevant_files_digest": "04be670b186dee291c30853b4b2e7405bb94859505edf8b6eb786412047801f3"
|
|
13
|
+
},
|
|
14
|
+
"acceptance_signature": "9a58e0e0571fac605e964b61a3e4668e895ef35440f7865f65515bf7beafd243",
|
|
15
|
+
"canonical_summary": {
|
|
16
|
+
"required_total": 12,
|
|
17
|
+
"required_passed": 12,
|
|
18
|
+
"supplemental_total": 0,
|
|
19
|
+
"supplemental_passed": 0
|
|
20
|
+
},
|
|
21
|
+
"physical_summary": {
|
|
22
|
+
"supporting_total": 0,
|
|
23
|
+
"supporting_passed": 0,
|
|
24
|
+
"total_executed": 12,
|
|
25
|
+
"total_passed": 12,
|
|
26
|
+
"total_failed": 0,
|
|
27
|
+
"total_skipped": 0
|
|
28
|
+
},
|
|
29
|
+
"reconciliation": {
|
|
30
|
+
"math_valid": true,
|
|
31
|
+
"phantoms_detected": 0,
|
|
32
|
+
"orphans_detected": 0,
|
|
33
|
+
"missing_canonical_ids": []
|
|
34
|
+
},
|
|
35
|
+
"task_traceability_summary": {
|
|
36
|
+
"tasks_total": 6,
|
|
37
|
+
"tasks_with_validation": 6,
|
|
38
|
+
"tasks_documentation_only": 0,
|
|
39
|
+
"unmapped_canonical_tests": []
|
|
40
|
+
},
|
|
41
|
+
"required_gates": {
|
|
42
|
+
"gate-test": "PASS",
|
|
43
|
+
"gate-ci-all": "PASS"
|
|
44
|
+
},
|
|
45
|
+
"supplemental_gates": {},
|
|
46
|
+
"exceptions": [],
|
|
47
|
+
"evidence_sources": [
|
|
48
|
+
{
|
|
49
|
+
"type": "PACKAGE_SCRIPT",
|
|
50
|
+
"script": "test",
|
|
51
|
+
"runner": "node:test",
|
|
52
|
+
"exit_code": 0,
|
|
53
|
+
"duration_ms": 401
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"blockers": [],
|
|
57
|
+
"warnings": []
|
|
58
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# Implementation Plan: Gemstack 2.0 Sprint D — Efficient Context & Persistent Memory
|
|
2
|
+
|
|
3
|
+
**Feature ID:** `014-gemstack-2.0-context-memory`
|
|
4
|
+
**Phase:** `plan`
|
|
5
|
+
**Parent Release:** `gemstack-ai@2.0.0-alpha`
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. Inherited Architecture Contracts
|
|
10
|
+
|
|
11
|
+
```gemstack-inherited-contracts
|
|
12
|
+
[
|
|
13
|
+
{
|
|
14
|
+
"id": "context-fatigue-guard",
|
|
15
|
+
"type": "BOOLEAN_INVARIANT",
|
|
16
|
+
"value": true
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"id": "offline-dependency-audit",
|
|
20
|
+
"type": "ENUM_SET",
|
|
21
|
+
"values": [
|
|
22
|
+
"orphan-detector",
|
|
23
|
+
"undeclared-detector",
|
|
24
|
+
"circular-cycle-detector",
|
|
25
|
+
"offline-purity"
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"id": "memory-git-cross-audit",
|
|
30
|
+
"type": "BOOLEAN_INVARIANT",
|
|
31
|
+
"value": true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"id": "capsule-noise-elimination",
|
|
35
|
+
"type": "BOOLEAN_INVARIANT",
|
|
36
|
+
"value": true
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 2. Technical Architecture & Modules
|
|
44
|
+
|
|
45
|
+
### 2.1 Context Fatigue & Noise Pruning (`src/lib/context-fatigue.js`)
|
|
46
|
+
- `detectContextFatigue(messages, options)`: Estimates token load, checks against threshold (default 16,000 tokens), computes redundancy ratio, and flags alert.
|
|
47
|
+
- `computeRedundancyRatio(messages)`: Detects duplicate substrings / repetitive prompt outputs.
|
|
48
|
+
- `pruneContextNoise(messages, options)`: Prunes duplicate tool outputs and ephemeral chit-chat while strictly retaining architectural decisions, contract declarations, and active tasks.
|
|
49
|
+
|
|
50
|
+
### 2.2 Offline Dependency Auditor (`src/lib/dependency-audit.js`)
|
|
51
|
+
- `auditDependencies(targetDir)`:
|
|
52
|
+
- Scans `package.json` dependencies and devDependencies.
|
|
53
|
+
- Scans `src/` and other source directories for Node.js `require()` and `import` patterns.
|
|
54
|
+
- Identifies:
|
|
55
|
+
- `orphans`: Declared dependencies that are never referenced in code.
|
|
56
|
+
- `undeclared`: Non-built-in packages imported in code that are missing from `package.json`.
|
|
57
|
+
- `circularCycles`: Dependency graph cycles using Tarjan's or DFS cycle detection.
|
|
58
|
+
- 100% offline, zero subprocess execution, zero network requests.
|
|
59
|
+
|
|
60
|
+
### 2.3 Memory Cross-Audit (`src/lib/memory-audit.js`)
|
|
61
|
+
- `crossAuditMemoryWithGit(targetDir, options)`:
|
|
62
|
+
- Reads `handoff.md` sections (ensuring Section 4 "Intentos fallidos" is intact).
|
|
63
|
+
- Fetches recent git log commits (`git log -n 10 --oneline`).
|
|
64
|
+
- Cross-references commit hashes or keywords against `handoff.md`.
|
|
65
|
+
- Flags `unrecorded_commits` when recent commits are completely missing from handoff notes.
|
|
66
|
+
|
|
67
|
+
### 2.4 CLI Integrations
|
|
68
|
+
- Integrate `dependency-audit` into `gemstack doctor` (`src/commands/doctor.js`).
|
|
69
|
+
- Integrate `memory-audit` into `gemstack verify` (`src/commands/verify.js`).
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 3. Physical Test Bindings
|
|
74
|
+
|
|
75
|
+
```gemstack-test-bindings
|
|
76
|
+
[
|
|
77
|
+
{
|
|
78
|
+
"id": "TEST-FATIGUE-A01",
|
|
79
|
+
"file": "tests/context-memory-p1.test.js",
|
|
80
|
+
"symbol": "Detects context fatigue when accumulated token count exceeds configurable threshold"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"id": "TEST-FATIGUE-A02",
|
|
84
|
+
"file": "tests/context-memory-p1.test.js",
|
|
85
|
+
"symbol": "Identifies repetitive context fragments and computes redundancy ratio accurately"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"id": "TEST-FATIGUE-A03",
|
|
89
|
+
"file": "tests/context-memory-p1.test.js",
|
|
90
|
+
"symbol": "Deterministically prunes noise and duplicate chatter while preserving contracts and state"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"id": "TEST-DEP-B01",
|
|
94
|
+
"file": "tests/context-memory-p1.test.js",
|
|
95
|
+
"symbol": "Detects orphan dependencies declared in package.json but never imported in code"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"id": "TEST-DEP-B02",
|
|
99
|
+
"file": "tests/context-memory-p1.test.js",
|
|
100
|
+
"symbol": "Detects undeclared module dependencies imported in code but missing from package.json"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"id": "TEST-DEP-B03",
|
|
104
|
+
"file": "tests/context-memory-p1.test.js",
|
|
105
|
+
"symbol": "Detects circular import cycles among local project modules"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"id": "TEST-DEP-B04",
|
|
109
|
+
"file": "tests/context-memory-p1.test.js",
|
|
110
|
+
"symbol": "Dependency auditor runs completely offline without spawning npm or network requests"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"id": "TEST-MEM-C01",
|
|
114
|
+
"file": "tests/context-memory-p1.test.js",
|
|
115
|
+
"symbol": "Detects discrepancies between recent git commit messages and handoff.md records"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"id": "TEST-MEM-C02",
|
|
119
|
+
"file": "tests/context-memory-p1.test.js",
|
|
120
|
+
"symbol": "Approves cleanly when all recent commits are accurately reflected in handoff.md"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"id": "TEST-MEM-C03",
|
|
124
|
+
"file": "tests/context-memory-p1.test.js",
|
|
125
|
+
"symbol": "Preserves section 4 Intentos fallidos and flags any attempt to mutate or delete it"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"id": "TEST-CAPSULE-D01",
|
|
129
|
+
"file": "tests/context-memory-p1.test.js",
|
|
130
|
+
"symbol": "Context capsule projection excludes ephemeral conversation logs and noise"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"id": "TEST-CAPSULE-D02",
|
|
134
|
+
"file": "tests/context-memory-p1.test.js",
|
|
135
|
+
"symbol": "Validates capsule determinism and size budget compliance (< 32KB)"
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## 4. Mandatory Package Script Closure Gates
|
|
143
|
+
|
|
144
|
+
```gemstack-closure-gates
|
|
145
|
+
[
|
|
146
|
+
{
|
|
147
|
+
"id": "gate-test",
|
|
148
|
+
"type": "PACKAGE_SCRIPT",
|
|
149
|
+
"script": "test",
|
|
150
|
+
"requirement": "REQUIRED",
|
|
151
|
+
"waivable": false
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"id": "gate-ci-all",
|
|
155
|
+
"type": "PACKAGE_SCRIPT",
|
|
156
|
+
"script": "ci:all",
|
|
157
|
+
"requirement": "REQUIRED",
|
|
158
|
+
"waivable": false
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
```
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# Specification: Gemstack 2.0 Sprint D — Efficient Context & Persistent Memory
|
|
2
|
+
|
|
3
|
+
**Feature ID:** `014-gemstack-2.0-context-memory`
|
|
4
|
+
**Phase:** `spec`
|
|
5
|
+
**Parent Release:** `gemstack-ai@2.0.0-alpha`
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. Context & Objectives
|
|
10
|
+
|
|
11
|
+
As agents and humans collaborate across long-running projects, context management and memory persistence become critical failure points:
|
|
12
|
+
1. **Context Fatigue & Noise**: Agents accumulate thousands of tokens of ephemeral chatter, duplicate error logs, and redundant prompt iterations, degrading reasoning accuracy.
|
|
13
|
+
2. **Dependency Blindness**: Unused or missing dependencies slip into `package.json`, and circular imports create subtle runtime bugs that standard linters miss.
|
|
14
|
+
3. **Memory Drift & Forgotten Commits**: Features get committed to git without being recorded in `handoff.md`, causing context loss across session boundaries.
|
|
15
|
+
|
|
16
|
+
Sprint D resolves these challenges by introducing:
|
|
17
|
+
- **Context Fatigue Detector & Noise Pruner**: Alerts when context exceeds thresholds or exhibits high redundancy, with deterministic noise pruning.
|
|
18
|
+
- **Offline Dependency Auditor in `gemstack doctor`**: Detects orphan dependencies, undeclared imports, and circular dependencies without external network calls.
|
|
19
|
+
- **Memory Cross-Verification**: Reconciles recent git commits with `handoff.md` before session handoff or verify closure.
|
|
20
|
+
- **Compressed Context Capsule Guard**: Enforces strict exclusion of ephemeral conversation chatter from capsules.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 2. Architecture Contracts
|
|
25
|
+
|
|
26
|
+
```gemstack-contracts
|
|
27
|
+
[
|
|
28
|
+
{
|
|
29
|
+
"id": "context-fatigue-guard",
|
|
30
|
+
"type": "BOOLEAN_INVARIANT",
|
|
31
|
+
"value": true,
|
|
32
|
+
"description": "Monitors accumulated tokens and flags warnings when redundancy ratio or token thresholds are exceeded."
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"id": "offline-dependency-audit",
|
|
36
|
+
"type": "ENUM_SET",
|
|
37
|
+
"values": [
|
|
38
|
+
"orphan-detector",
|
|
39
|
+
"undeclared-detector",
|
|
40
|
+
"circular-cycle-detector",
|
|
41
|
+
"offline-purity"
|
|
42
|
+
],
|
|
43
|
+
"description": "Capabilities of the offline dependency auditor in gemstack doctor."
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"id": "memory-git-cross-audit",
|
|
47
|
+
"type": "BOOLEAN_INVARIANT",
|
|
48
|
+
"value": true,
|
|
49
|
+
"description": "Cross-verifies recent git commit activity against handoff.md before session close."
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"id": "capsule-noise-elimination",
|
|
53
|
+
"type": "BOOLEAN_INVARIANT",
|
|
54
|
+
"value": true,
|
|
55
|
+
"description": "Ensures context capsules strictly exclude chat history and ephemeral noise."
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 3. Mechanical Acceptance Matrix
|
|
63
|
+
|
|
64
|
+
```gemstack-test-matrix
|
|
65
|
+
[
|
|
66
|
+
{
|
|
67
|
+
"id": "TEST-FATIGUE-A01",
|
|
68
|
+
"category": "CONTEXT",
|
|
69
|
+
"layer": "UNIT",
|
|
70
|
+
"description": "Detects context fatigue when accumulated token count exceeds configurable threshold",
|
|
71
|
+
"pass_criteria": "detectContextFatigue returns fatigue=true and alert message when tokens > limit",
|
|
72
|
+
"gate": "REQUIRED"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"id": "TEST-FATIGUE-A02",
|
|
76
|
+
"category": "CONTEXT",
|
|
77
|
+
"layer": "UNIT",
|
|
78
|
+
"description": "Identifies repetitive context fragments and computes redundancy ratio accurately",
|
|
79
|
+
"pass_criteria": "computeRedundancyRatio correctly calculates duplicate token ratio",
|
|
80
|
+
"gate": "REQUIRED"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"id": "TEST-FATIGUE-A03",
|
|
84
|
+
"category": "CONTEXT",
|
|
85
|
+
"layer": "UNIT",
|
|
86
|
+
"description": "Deterministically prunes noise and duplicate chatter while preserving contracts and state",
|
|
87
|
+
"pass_criteria": "pruneContextNoise reduces size while preserving all architectural contracts and state items",
|
|
88
|
+
"gate": "REQUIRED"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"id": "TEST-DEP-B01",
|
|
92
|
+
"category": "DEPENDENCY",
|
|
93
|
+
"layer": "UNIT",
|
|
94
|
+
"description": "Detects orphan dependencies declared in package.json but never imported in code",
|
|
95
|
+
"pass_criteria": "auditDependencies reports orphan array containing unused dependencies",
|
|
96
|
+
"gate": "REQUIRED"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"id": "TEST-DEP-B02",
|
|
100
|
+
"category": "DEPENDENCY",
|
|
101
|
+
"layer": "UNIT",
|
|
102
|
+
"description": "Detects undeclared module dependencies imported in code but missing from package.json",
|
|
103
|
+
"pass_criteria": "auditDependencies reports undeclared array containing missing packages",
|
|
104
|
+
"gate": "REQUIRED"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"id": "TEST-DEP-B03",
|
|
108
|
+
"category": "DEPENDENCY",
|
|
109
|
+
"layer": "UNIT",
|
|
110
|
+
"description": "Detects circular import cycles among local project modules",
|
|
111
|
+
"pass_criteria": "auditDependencies flags circularCycles with the exact cycle path",
|
|
112
|
+
"gate": "REQUIRED"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"id": "TEST-DEP-B04",
|
|
116
|
+
"category": "DEPENDENCY",
|
|
117
|
+
"layer": "UNIT",
|
|
118
|
+
"description": "Dependency auditor runs completely offline without spawning npm or network requests",
|
|
119
|
+
"pass_criteria": "Runs in <100ms with zero network handles or subprocess calls",
|
|
120
|
+
"gate": "REQUIRED"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"id": "TEST-MEM-C01",
|
|
124
|
+
"category": "MEMORY",
|
|
125
|
+
"layer": "UNIT",
|
|
126
|
+
"description": "Detects discrepancies between recent git commit messages and handoff.md records",
|
|
127
|
+
"pass_criteria": "crossAuditMemoryWithGit flags unrecorded_commits when commits are missing from handoff",
|
|
128
|
+
"gate": "REQUIRED"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"id": "TEST-MEM-C02",
|
|
132
|
+
"category": "MEMORY",
|
|
133
|
+
"layer": "UNIT",
|
|
134
|
+
"description": "Approves cleanly when all recent commits are accurately reflected in handoff.md",
|
|
135
|
+
"pass_criteria": "Returns valid=true and empty unrecorded_commits when handoff reflects git log",
|
|
136
|
+
"gate": "REQUIRED"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"id": "TEST-MEM-C03",
|
|
140
|
+
"category": "MEMORY",
|
|
141
|
+
"layer": "UNIT",
|
|
142
|
+
"description": "Preserves section 4 Intentos fallidos and flags any attempt to mutate or delete it",
|
|
143
|
+
"pass_criteria": "Throws or flags error if section 4 is deleted or corrupted in handoff",
|
|
144
|
+
"gate": "REQUIRED"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"id": "TEST-CAPSULE-D01",
|
|
148
|
+
"category": "CAPSULE",
|
|
149
|
+
"layer": "UNIT",
|
|
150
|
+
"description": "Context capsule projection excludes ephemeral conversation logs and noise",
|
|
151
|
+
"pass_criteria": "Generates capsule without any chat history or transient prompt messages",
|
|
152
|
+
"gate": "REQUIRED"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"id": "TEST-CAPSULE-D02",
|
|
156
|
+
"category": "CAPSULE",
|
|
157
|
+
"layer": "UNIT",
|
|
158
|
+
"description": "Validates capsule determinism and size budget compliance (< 32KB)",
|
|
159
|
+
"pass_criteria": "Capsule bytes <= 32768 and canonical hash is identical across successive runs",
|
|
160
|
+
"gate": "REQUIRED"
|
|
161
|
+
}
|
|
162
|
+
]
|
|
163
|
+
```
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Tasks Breakdown: Gemstack 2.0 Sprint D — Efficient Context & Persistent Memory
|
|
2
|
+
|
|
3
|
+
**Feature ID:** `014-gemstack-2.0-context-memory`
|
|
4
|
+
**Phase:** `tasks`
|
|
5
|
+
**Parent Release:** `gemstack-ai@2.0.0-alpha`
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. Inherited Architecture Contracts
|
|
10
|
+
|
|
11
|
+
```gemstack-contracts
|
|
12
|
+
[
|
|
13
|
+
{
|
|
14
|
+
"id": "context-fatigue-guard",
|
|
15
|
+
"type": "BOOLEAN_INVARIANT",
|
|
16
|
+
"value": true
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"id": "offline-dependency-audit",
|
|
20
|
+
"type": "ENUM_SET",
|
|
21
|
+
"values": [
|
|
22
|
+
"orphan-detector",
|
|
23
|
+
"undeclared-detector",
|
|
24
|
+
"circular-cycle-detector",
|
|
25
|
+
"offline-purity"
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"id": "memory-git-cross-audit",
|
|
30
|
+
"type": "BOOLEAN_INVARIANT",
|
|
31
|
+
"value": true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"id": "capsule-noise-elimination",
|
|
35
|
+
"type": "BOOLEAN_INVARIANT",
|
|
36
|
+
"value": true
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 2. Task Inventory
|
|
44
|
+
|
|
45
|
+
- [x] **TASK-001: Author comprehensive test suite for Context & Memory**
|
|
46
|
+
<!-- gemstack:validation_required=true -->
|
|
47
|
+
<!-- gemstack:tests=TEST-FATIGUE-A01, TEST-FATIGUE-A02, TEST-FATIGUE-A03, TEST-DEP-B01, TEST-DEP-B02, TEST-DEP-B03, TEST-DEP-B04, TEST-MEM-C01, TEST-MEM-C02, TEST-MEM-C03, TEST-CAPSULE-D01, TEST-CAPSULE-D02 -->
|
|
48
|
+
<!-- gemstack:files=tests/context-memory-p1.test.js -->
|
|
49
|
+
<!-- gemstack:depends= -->
|
|
50
|
+
|
|
51
|
+
- [x] **TASK-002: Implement Context Fatigue Engine & Noise Pruning**
|
|
52
|
+
<!-- gemstack:validation_required=true -->
|
|
53
|
+
<!-- gemstack:tests=TEST-FATIGUE-A01, TEST-FATIGUE-A02, TEST-FATIGUE-A03 -->
|
|
54
|
+
<!-- gemstack:files=src/lib/context-fatigue.js -->
|
|
55
|
+
<!-- gemstack:depends=TASK-001 -->
|
|
56
|
+
|
|
57
|
+
- [x] **TASK-003: Implement Offline Dependency Auditor**
|
|
58
|
+
<!-- gemstack:validation_required=true -->
|
|
59
|
+
<!-- gemstack:tests=TEST-DEP-B01, TEST-DEP-B02, TEST-DEP-B03, TEST-DEP-B04 -->
|
|
60
|
+
<!-- gemstack:files=src/lib/dependency-audit.js -->
|
|
61
|
+
<!-- gemstack:depends=TASK-001 -->
|
|
62
|
+
|
|
63
|
+
- [x] **TASK-004: Implement Memory Cross-Auditor**
|
|
64
|
+
<!-- gemstack:validation_required=true -->
|
|
65
|
+
<!-- gemstack:tests=TEST-MEM-C01, TEST-MEM-C02, TEST-MEM-C03 -->
|
|
66
|
+
<!-- gemstack:files=src/lib/memory-audit.js -->
|
|
67
|
+
<!-- gemstack:depends=TASK-001 -->
|
|
68
|
+
|
|
69
|
+
- [x] **TASK-005: Enforce Capsule Noise Elimination and Determinism**
|
|
70
|
+
<!-- gemstack:validation_required=true -->
|
|
71
|
+
<!-- gemstack:tests=TEST-CAPSULE-D01, TEST-CAPSULE-D02 -->
|
|
72
|
+
<!-- gemstack:files=src/lib/context-capsule.js -->
|
|
73
|
+
<!-- gemstack:depends=TASK-001 -->
|
|
74
|
+
|
|
75
|
+
- [x] **TASK-006: Integrate CLI commands, wire test suite, and collect closure evidence**
|
|
76
|
+
<!-- gemstack:validation_required=true -->
|
|
77
|
+
<!-- gemstack:tests=TEST-FATIGUE-A01, TEST-FATIGUE-A02, TEST-FATIGUE-A03, TEST-DEP-B01, TEST-DEP-B02, TEST-DEP-B03, TEST-DEP-B04, TEST-MEM-C01, TEST-MEM-C02, TEST-MEM-C03, TEST-CAPSULE-D01, TEST-CAPSULE-D02 -->
|
|
78
|
+
<!-- gemstack:files=src/commands/doctor.js, src/commands/verify.js, package.json -->
|
|
79
|
+
<!-- gemstack:depends=TASK-002, TASK-003, TASK-004, TASK-005 -->
|
package/src/cli.js
CHANGED
|
@@ -14,6 +14,7 @@ const shipCommand = require('./commands/ship');
|
|
|
14
14
|
const contextCommand = require('./commands/context');
|
|
15
15
|
const swarmCommand = require('./commands/swarm');
|
|
16
16
|
const visualCommand = require('./commands/visual');
|
|
17
|
+
const specCommand = require('./commands/spec');
|
|
17
18
|
|
|
18
19
|
async function main() {
|
|
19
20
|
const { command, args, flags } = parser.parse(process.argv);
|
|
@@ -30,6 +31,7 @@ Commands:
|
|
|
30
31
|
context Generate, show, or verify context capsule
|
|
31
32
|
swarm Plan or validate agent swarm work and write partitions
|
|
32
33
|
vqa Validate or promote visual QA manifests and evidence
|
|
34
|
+
spec Validate spec rigor, merge concurrent specs, and check conflicts
|
|
33
35
|
list List available skills
|
|
34
36
|
show Show content of a skill
|
|
35
37
|
handoff Show content of handoff.md
|
|
@@ -58,6 +60,7 @@ Options:
|
|
|
58
60
|
case 'swarm': await swarmCommand(args, flags); break;
|
|
59
61
|
case 'vqa':
|
|
60
62
|
case 'visual': await visualCommand(args, flags); break;
|
|
63
|
+
case 'spec': await specCommand(args, flags); break;
|
|
61
64
|
case 'list': await listCommand(flags); break;
|
|
62
65
|
case 'show': await showCommand(args[0], flags); break;
|
|
63
66
|
case 'hooks': hooksCommand.installHooks(flags.target); break;
|
package/src/commands/doctor.js
CHANGED
|
@@ -46,5 +46,23 @@ module.exports = async (flags) => {
|
|
|
46
46
|
} else {
|
|
47
47
|
logger.warn('.gitignore is not patched.');
|
|
48
48
|
}
|
|
49
|
+
|
|
50
|
+
// Offline Dependency Audit (Gemstack 2.0 Sprint D)
|
|
51
|
+
const { auditDependencies } = require('../lib/dependency-audit');
|
|
52
|
+
const depAudit = auditDependencies(targetDir);
|
|
53
|
+
if (depAudit.orphans.length > 0) {
|
|
54
|
+
logger.warn(`Orphan dependencies detected in package.json: ${depAudit.orphans.join(', ')}`);
|
|
55
|
+
} else {
|
|
56
|
+
logger.ok('Zero orphan dependencies detected.');
|
|
57
|
+
}
|
|
58
|
+
if (depAudit.undeclared.length > 0) {
|
|
59
|
+
logger.warn(`Undeclared dependencies used in source: ${depAudit.undeclared.join(', ')}`);
|
|
60
|
+
}
|
|
61
|
+
if (depAudit.circularCycles.length > 0) {
|
|
62
|
+
logger.warn(`Circular import cycles detected: ${depAudit.circularCycles.map(c => c.join(' -> ')).join('; ')}`);
|
|
63
|
+
} else {
|
|
64
|
+
logger.ok('Zero circular import cycles detected.');
|
|
65
|
+
}
|
|
66
|
+
|
|
49
67
|
logger.ok('Doctor checks completed.');
|
|
50
68
|
};
|