@fingerskier/augment 0.3.1 → 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.
- package/README.md +37 -20
- package/dist/cli.d.ts +9 -6
- package/dist/cli.js +9 -43
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +2 -0
- package/dist/config.js +2 -1
- package/dist/config.js.map +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +7 -0
- package/dist/constants.js.map +1 -1
- package/dist/daemon/client.d.ts +10 -2
- package/dist/daemon/client.js +30 -4
- package/dist/daemon/client.js.map +1 -1
- package/dist/daemon/http.js +163 -28
- package/dist/daemon/http.js.map +1 -1
- package/dist/db.d.ts +1 -0
- package/dist/db.js +35 -4
- package/dist/db.js.map +1 -1
- package/dist/decoction.d.ts +51 -0
- package/dist/decoction.js +184 -0
- package/dist/decoction.js.map +1 -0
- package/dist/install.d.ts +2 -0
- package/dist/install.js +68 -5
- package/dist/install.js.map +1 -1
- package/dist/mcp/apps.js +0 -16
- package/dist/mcp/apps.js.map +1 -1
- package/dist/mcp/insights.d.ts +4 -6
- package/dist/mcp/insights.js +4 -11
- package/dist/mcp/insights.js.map +1 -1
- package/dist/mcp/server.js +124 -21
- package/dist/mcp/server.js.map +1 -1
- package/dist/memory/files.js +32 -2
- package/dist/memory/files.js.map +1 -1
- package/dist/memory/git.d.ts +5 -1
- package/dist/memory/git.js +7 -3
- package/dist/memory/git.js.map +1 -1
- package/dist/memory/project.d.ts +3 -0
- package/dist/memory/project.js +20 -0
- package/dist/memory/project.js.map +1 -1
- package/dist/pi/extension.d.ts +10 -2
- package/dist/pi/extension.js +82 -46
- package/dist/pi/extension.js.map +1 -1
- package/dist/proposals.d.ts +42 -0
- package/dist/proposals.js +180 -0
- package/dist/proposals.js.map +1 -0
- package/dist/recall-log.d.ts +21 -0
- package/dist/recall-log.js +24 -0
- package/dist/recall-log.js.map +1 -0
- package/dist/recall.d.ts +1 -1
- package/dist/service.d.ts +197 -2
- package/dist/service.js +770 -42
- package/dist/service.js.map +1 -1
- package/dist/types.d.ts +26 -2
- package/docs/FEATURES.md +247 -33
- package/docs/verify-memory-flow.md +132 -131
- package/integrations/claude/skills/augment-context/SKILL.md +74 -0
- package/integrations/claude/skills/augment-decoction/SKILL.md +36 -0
- package/integrations/claude/skills/augment-dream/SKILL.md +34 -0
- package/integrations/claude/skills/augment-dream/agents/openai.yaml +4 -0
- package/integrations/claude/skills/augment-sleep/SKILL.md +26 -0
- package/integrations/codex/SKILL.md +33 -0
- package/integrations/pi/skills/augment-decoction/SKILL.md +37 -0
- package/integrations/pi/skills/augment-dream/SKILL.md +36 -0
- package/package.json +16 -15
- package/dist/tally.d.ts +0 -46
- package/dist/tally.js +0 -94
- package/dist/tally.js.map +0 -1
package/dist/service.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { AugmentConfig } from "./config.js";
|
|
2
2
|
import { AugmentDatabase } from "./db.js";
|
|
3
|
+
import { type DecoctionDiscoveryCluster } from "./decoction.js";
|
|
3
4
|
import type { EmbeddingProvider } from "./embeddings.js";
|
|
5
|
+
import type { LinkType, MemoryKind } from "./constants.js";
|
|
6
|
+
import { type Proposal, type ProposalStatus } from "./proposals.js";
|
|
4
7
|
import { type SleepCluster } from "./sleep.js";
|
|
5
8
|
import type { LinkRecord, MemoryRecord, ProjectGraph, ProjectRecord, SearchInput, SearchResult, UpsertInput } from "./types.js";
|
|
6
9
|
export interface InitProjectInput {
|
|
@@ -15,6 +18,58 @@ export interface SearchOutput {
|
|
|
15
18
|
text: string;
|
|
16
19
|
results: SearchResult[];
|
|
17
20
|
}
|
|
21
|
+
export interface DecoctionRemovalSuggestion {
|
|
22
|
+
path: string;
|
|
23
|
+
reason: string;
|
|
24
|
+
}
|
|
25
|
+
export interface DecoctionGleanDiscoverInput {
|
|
26
|
+
action: "discover";
|
|
27
|
+
min_cosine?: number;
|
|
28
|
+
limit?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface DecoctionGleanWriteInput {
|
|
31
|
+
action: "write";
|
|
32
|
+
kind: "SPEC" | "ARCH";
|
|
33
|
+
name: string;
|
|
34
|
+
content: string;
|
|
35
|
+
tags?: string[];
|
|
36
|
+
derived_from: string[];
|
|
37
|
+
suggested_removals?: DecoctionRemovalSuggestion[];
|
|
38
|
+
expected_content_hash?: string;
|
|
39
|
+
expected_frontmatter_hash?: string;
|
|
40
|
+
}
|
|
41
|
+
export type DecoctionGleanInput = DecoctionGleanDiscoverInput | DecoctionGleanWriteInput;
|
|
42
|
+
export interface DecoctionGleanDiscoverOutput {
|
|
43
|
+
action: "discover";
|
|
44
|
+
text: string;
|
|
45
|
+
eligible: number;
|
|
46
|
+
embedded: number;
|
|
47
|
+
min_cosine: number;
|
|
48
|
+
min_projects: number;
|
|
49
|
+
clusters: DecoctionDiscoveryCluster[];
|
|
50
|
+
}
|
|
51
|
+
export interface DecoctionGleanWriteOutput {
|
|
52
|
+
action: "write";
|
|
53
|
+
memory: MemoryRecord;
|
|
54
|
+
upsert_action: UpsertResult["action"];
|
|
55
|
+
suggested_removals: DecoctionRemovalSuggestion[];
|
|
56
|
+
warnings: string[];
|
|
57
|
+
text: string;
|
|
58
|
+
}
|
|
59
|
+
export interface DecoctionCleanupInput {
|
|
60
|
+
generic_path: string;
|
|
61
|
+
source_paths: string[];
|
|
62
|
+
}
|
|
63
|
+
export interface DecoctionCleanupResult {
|
|
64
|
+
generic_path: string;
|
|
65
|
+
results: Array<{
|
|
66
|
+
source_path: string;
|
|
67
|
+
status: "deleted" | "failed";
|
|
68
|
+
retargeted_links: number;
|
|
69
|
+
error?: string;
|
|
70
|
+
}>;
|
|
71
|
+
text: string;
|
|
72
|
+
}
|
|
18
73
|
export interface SleepCandidatesInput {
|
|
19
74
|
/** Restrict to one project; omit to preview candidates in every project (clusters never span projects). */
|
|
20
75
|
project_name?: string;
|
|
@@ -28,6 +83,64 @@ export interface SleepCandidatesOutput {
|
|
|
28
83
|
clusters: SleepCluster[];
|
|
29
84
|
eligible: number;
|
|
30
85
|
}
|
|
86
|
+
/** Draft a sleep consolidation: >=2 WORK sources fold into one new SPEC/ARCH.
|
|
87
|
+
* The proposal is written OUTSIDE the corpus for review; nothing is consolidated
|
|
88
|
+
* until {@link AugmentService.sleepApply}. */
|
|
89
|
+
export interface SleepProposeInput {
|
|
90
|
+
project_name: string;
|
|
91
|
+
kind: "SPEC" | "ARCH";
|
|
92
|
+
name: string;
|
|
93
|
+
content: string;
|
|
94
|
+
derived_from: string[];
|
|
95
|
+
rationale?: string;
|
|
96
|
+
}
|
|
97
|
+
export interface SleepApplyInput {
|
|
98
|
+
filename: string;
|
|
99
|
+
}
|
|
100
|
+
export interface SleepApplyOutput {
|
|
101
|
+
memory: MemoryRecord;
|
|
102
|
+
archived: string[];
|
|
103
|
+
proposal: Proposal;
|
|
104
|
+
text: string;
|
|
105
|
+
}
|
|
106
|
+
/** Draft a speculative memory in the active project from one or more existing
|
|
107
|
+
* inspirations. Inspirations are deliberately global: they may belong to the
|
|
108
|
+
* active project, the reserved generic project, or any foreign project. */
|
|
109
|
+
export interface DreamMemoryProposeInput {
|
|
110
|
+
project_name: string;
|
|
111
|
+
kind: MemoryKind;
|
|
112
|
+
name: string;
|
|
113
|
+
content: string;
|
|
114
|
+
derived_from: string[];
|
|
115
|
+
rationale?: string;
|
|
116
|
+
link?: never;
|
|
117
|
+
}
|
|
118
|
+
/** Draft a speculative link. Applying it may only rewrite a source in the
|
|
119
|
+
* active project, while the target may be current, generic, or foreign. */
|
|
120
|
+
export interface DreamLinkProposeInput {
|
|
121
|
+
project_name: string;
|
|
122
|
+
link: {
|
|
123
|
+
from: string;
|
|
124
|
+
to: string;
|
|
125
|
+
type: LinkType;
|
|
126
|
+
};
|
|
127
|
+
rationale?: string;
|
|
128
|
+
kind?: never;
|
|
129
|
+
name?: never;
|
|
130
|
+
content?: never;
|
|
131
|
+
derived_from?: never;
|
|
132
|
+
}
|
|
133
|
+
export type DreamProposeInput = DreamMemoryProposeInput | DreamLinkProposeInput;
|
|
134
|
+
export interface DreamApplyInput {
|
|
135
|
+
filename: string;
|
|
136
|
+
}
|
|
137
|
+
export interface DreamApplyOutput {
|
|
138
|
+
type: "dream-memory" | "dream-link";
|
|
139
|
+
proposal: Proposal;
|
|
140
|
+
memory?: MemoryRecord;
|
|
141
|
+
link?: LinkRecord;
|
|
142
|
+
text: string;
|
|
143
|
+
}
|
|
31
144
|
export declare class AugmentService {
|
|
32
145
|
private readonly config;
|
|
33
146
|
private readonly embeddingProvider;
|
|
@@ -44,6 +157,10 @@ export declare class AugmentService {
|
|
|
44
157
|
* searches. */
|
|
45
158
|
private corpusPromise?;
|
|
46
159
|
private readonly queryEmbeddingCache;
|
|
160
|
+
/** FIFO critical section for every corpus mutation. Compound operations use
|
|
161
|
+
* their private `*Core` helpers while holding this lock so their validation,
|
|
162
|
+
* frontmatter rewrites, and deletes cannot interleave with another request. */
|
|
163
|
+
private mutationTail;
|
|
47
164
|
constructor(config: AugmentConfig, embeddingProvider?: EmbeddingProvider);
|
|
48
165
|
useStateDir(stateDir: string): void;
|
|
49
166
|
close(): Promise<void>;
|
|
@@ -72,6 +189,7 @@ export declare class AugmentService {
|
|
|
72
189
|
*/
|
|
73
190
|
consumeSelfWrite(relativePath: string): boolean;
|
|
74
191
|
private recordSelfWrite;
|
|
192
|
+
private memoryFileExists;
|
|
75
193
|
upsert(input: UpsertInput): Promise<UpsertResult>;
|
|
76
194
|
private upsertCore;
|
|
77
195
|
read(id: number): Promise<MemoryRecord>;
|
|
@@ -101,17 +219,94 @@ export declare class AugmentService {
|
|
|
101
219
|
}>;
|
|
102
220
|
private unlinkCore;
|
|
103
221
|
private invalidateCorpusSnapshot;
|
|
222
|
+
/** Queue one corpus mutation after the previous request, keeping the queue
|
|
223
|
+
* usable after failures. Assignment happens synchronously before any caller
|
|
224
|
+
* can enqueue the next request. */
|
|
225
|
+
private serializeMutation;
|
|
104
226
|
private corpus;
|
|
105
227
|
/** Query vectors depend only on the query text and the (process-pinned) model,
|
|
106
228
|
* so unlike the corpus snapshot they never need invalidating on writes. */
|
|
107
229
|
private embedQuery;
|
|
108
230
|
search(input: SearchInput): Promise<SearchOutput>;
|
|
231
|
+
decoctionGlean(input: DecoctionGleanDiscoverInput): Promise<DecoctionGleanDiscoverOutput>;
|
|
232
|
+
decoctionGlean(input: DecoctionGleanWriteInput): Promise<DecoctionGleanWriteOutput>;
|
|
233
|
+
private decoctionGleanWrite;
|
|
234
|
+
decoctionCleanup(input: DecoctionCleanupInput): Promise<DecoctionCleanupResult>;
|
|
235
|
+
private decoctionCleanupCore;
|
|
109
236
|
/**
|
|
110
237
|
* READ-ONLY sleep preview: which settled WORK memories WOULD consolidate.
|
|
111
|
-
* Performs zero writes
|
|
112
|
-
*
|
|
238
|
+
* Performs zero writes; an agent must draft a proposal and receive explicit
|
|
239
|
+
* user approval before `sleep_apply` changes the corpus.
|
|
113
240
|
*/
|
|
114
241
|
sleepCandidates(input?: SleepCandidatesInput, now?: number): Promise<SleepCandidatesOutput>;
|
|
242
|
+
/**
|
|
243
|
+
* Draft a sleep consolidation as a review artifact OUTSIDE the corpus. Writes
|
|
244
|
+
* nothing to the memory store: the corpus is only mutated by {@link sleepApply}
|
|
245
|
+
* on an explicitly approved proposal. Validates the sources up front (same
|
|
246
|
+
* checks apply re-runs against the live corpus) so an impossible proposal fails
|
|
247
|
+
* loudly at draft time.
|
|
248
|
+
*/
|
|
249
|
+
sleepPropose(input: SleepProposeInput): Promise<{
|
|
250
|
+
proposal: Proposal;
|
|
251
|
+
text: string;
|
|
252
|
+
}>;
|
|
253
|
+
sleepProposals(status?: ProposalStatus): Promise<{
|
|
254
|
+
proposals: Proposal[];
|
|
255
|
+
text: string;
|
|
256
|
+
}>;
|
|
257
|
+
/**
|
|
258
|
+
* Apply an approved sleep proposal — the ONLY corpus mutation in the flow. The
|
|
259
|
+
* sequence is a contract: read the proposal fresh from disk (user edits count),
|
|
260
|
+
* require it still be `proposed`, re-validate against the LIVE corpus (drafts
|
|
261
|
+
* sit while the corpus moves underneath them), upsert the consolidated record
|
|
262
|
+
* (provenance threaded into frontmatter), archive each source in place (body
|
|
263
|
+
* untouched, verbatim), then flip the proposal to `applied`. Does NOT commit
|
|
264
|
+
* git: the route commits the whole pass as one revertible commit.
|
|
265
|
+
*/
|
|
266
|
+
sleepApply(input: SleepApplyInput): Promise<SleepApplyOutput>;
|
|
267
|
+
private sleepApplyCore;
|
|
268
|
+
sleepReject(filename: string): Promise<{
|
|
269
|
+
proposal: Proposal;
|
|
270
|
+
text: string;
|
|
271
|
+
}>;
|
|
272
|
+
/**
|
|
273
|
+
* Draft one speculative memory or link outside the corpus. The daemon never
|
|
274
|
+
* synthesizes a dream: an agent supplies the complete candidate and this
|
|
275
|
+
* method only validates its live references and writes a review artifact.
|
|
276
|
+
*/
|
|
277
|
+
dreamPropose(input: DreamProposeInput): Promise<{
|
|
278
|
+
proposal: Proposal;
|
|
279
|
+
text: string;
|
|
280
|
+
}>;
|
|
281
|
+
/** List the whole dreams/ proposal family, including both dream-memory and
|
|
282
|
+
* dream-link records. `dream-memory` is intentionally only the directory
|
|
283
|
+
* selector used by the shared proposal store. */
|
|
284
|
+
dreamProposals(status?: ProposalStatus): Promise<{
|
|
285
|
+
proposals: Proposal[];
|
|
286
|
+
text: string;
|
|
287
|
+
}>;
|
|
288
|
+
/** Apply the explicitly approved proposal after re-reading and re-validating
|
|
289
|
+
* it against the live corpus. The HTTP route owns the single git commit. */
|
|
290
|
+
dreamApply(input: DreamApplyInput): Promise<DreamApplyOutput>;
|
|
291
|
+
private dreamApplyCore;
|
|
292
|
+
dreamReject(filename: string): Promise<{
|
|
293
|
+
proposal: Proposal;
|
|
294
|
+
text: string;
|
|
295
|
+
}>;
|
|
296
|
+
private validateDreamMemory;
|
|
297
|
+
private validateDreamLink;
|
|
298
|
+
/**
|
|
299
|
+
* Shared sleep validation, run at propose time and re-run against the live
|
|
300
|
+
* corpus at apply time. Every source must resolve, be a WORK memory in
|
|
301
|
+
* `projectName` (single-project constraint), and be unarchived; there must be
|
|
302
|
+
* >=2 of them; and the consolidation target must not already exist. Every
|
|
303
|
+
* violation names the offending path.
|
|
304
|
+
*/
|
|
305
|
+
private validateSleepSources;
|
|
306
|
+
/** Rewrite one source's frontmatter to archived + consolidated_into, leaving
|
|
307
|
+
* the body verbatim, and reindex it. Mirrors {@link scrubInboundLinks}. Returns
|
|
308
|
+
* the source's relative path. */
|
|
309
|
+
private archiveSource;
|
|
115
310
|
private findSimilarMemory;
|
|
116
311
|
private ensureEmbedding;
|
|
117
312
|
}
|