greprag 5.49.6 → 5.49.9
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/dist/commands/collision-reminder.d.ts +14 -0
- package/dist/commands/collision-reminder.js +40 -0
- package/dist/commands/collision-reminder.js.map +1 -0
- package/dist/commands/coordinate-gate.d.ts +12 -6
- package/dist/commands/coordinate-gate.js +24 -10
- package/dist/commands/coordinate-gate.js.map +1 -1
- package/dist/commands/corpus/client.d.ts +5 -1
- package/dist/commands/corpus/client.js +10 -3
- package/dist/commands/corpus/client.js.map +1 -1
- package/dist/commands/corpus/index.js +21 -1
- package/dist/commands/corpus/index.js.map +1 -1
- package/dist/commands/corpus/manage.js +31 -5
- package/dist/commands/corpus/manage.js.map +1 -1
- package/dist/commands/corpus/search.js +13 -6
- package/dist/commands/corpus/search.js.map +1 -1
- package/dist/commands/corpus/status.js +2 -1
- package/dist/commands/corpus/status.js.map +1 -1
- package/dist/commands/corpus/tags.d.ts +17 -0
- package/dist/commands/corpus/tags.js +91 -0
- package/dist/commands/corpus/tags.js.map +1 -0
- package/dist/commands/corpus-reminder.d.ts +15 -0
- package/dist/commands/corpus-reminder.js +34 -0
- package/dist/commands/corpus-reminder.js.map +1 -0
- package/dist/commands/friction-reminder.d.ts +22 -44
- package/dist/commands/friction-reminder.js +45 -63
- package/dist/commands/friction-reminder.js.map +1 -1
- package/dist/commands/init.js +7 -14
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/load-primer-reminder.d.ts +28 -0
- package/dist/commands/load-primer-reminder.js +51 -0
- package/dist/commands/load-primer-reminder.js.map +1 -0
- package/dist/commands/load.d.ts +15 -0
- package/dist/commands/load.js +112 -0
- package/dist/commands/load.js.map +1 -0
- package/dist/commands/memory-reflex.d.ts +17 -112
- package/dist/commands/memory-reflex.js +24 -233
- package/dist/commands/memory-reflex.js.map +1 -1
- package/dist/commands/reminder-registry.d.ts +12 -1
- package/dist/commands/reminder-registry.js +48 -4
- package/dist/commands/reminder-registry.js.map +1 -1
- package/dist/commands/reminder-types.d.ts +33 -0
- package/dist/commands/version-reminder.d.ts +15 -0
- package/dist/commands/version-reminder.js +34 -0
- package/dist/commands/version-reminder.js.map +1 -0
- package/dist/hook.js +134 -274
- package/dist/hook.js.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/skill/templates/chip-leader.md +188 -0
- package/skill/templates/chip-spawn.md +4 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tags.js","sourceRoot":"","sources":["../../../src/commands/corpus/tags.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;AAQH,wBAgCC;AAED,4BAgBC;AAED,0BAyBC;AAnFD,qCAEkB;AAElB,MAAM,SAAS,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;AAEzD,KAAK,UAAU,MAAM,CAAC,IAAc;IACzC,MAAM,GAAG,GAAG,IAAA,kBAAS,GAAE,CAAC;IACxB,IAAI,CAAC,GAAG,CAAC,MAAM;QAAE,IAAA,2BAAkB,GAAE,CAAC;IAEtC,mEAAmE;IACnE,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACvB,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACvB,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;YACvB,OAAO,CAAC,KAAK,CAAC,oDAAoD,CAAC,CAAC;YACpE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,MAAM,GAAG,GAAG,MAAM,IAAA,gBAAO,EACvB,GAAG,GAAG,CAAC,MAAM,wBAAwB,EAAE,GAAG,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,C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,GAAG,CAAC,4DAA4D,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpG,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAC;IACtE,OAAO,CAAC,GAAG,CAAC,8FAA8F,CAAC,CAAC;AAC9G,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** corpus-announce — the SessionStart announce that names the api-docs-tagged
|
|
2
|
+
* corpus stores on tap + the directive to SEARCH them before answering from
|
|
3
|
+
* training data. The reminder-interrupt "announce" half (load-once schema,
|
|
4
|
+
* never a per-turn nag).
|
|
5
|
+
*
|
|
6
|
+
* WHY: the tenant carries vendor/API reference banks (Stripe, QuickBooks,
|
|
7
|
+
* Cloudflare, Procore, Claude Code docs) as corpus stores tagged `api-docs`.
|
|
8
|
+
* An agent that doesn't know they exist answers from stale training data. This
|
|
9
|
+
* surfaces the set once per session, with the one command that searches it.
|
|
10
|
+
*
|
|
11
|
+
* Lean by construction: silent unless the tenant actually has api-docs-tagged
|
|
12
|
+
* stores (env.corpusApiDocs precomputed by the hook). adr: adr/corpus-tags.md */
|
|
13
|
+
import { ReminderModule } from './reminder-types';
|
|
14
|
+
export declare function buildCorpusAnnounce(names: string[]): string | null;
|
|
15
|
+
export declare const corpusAnnounceModule: ReminderModule;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** corpus-announce — the SessionStart announce that names the api-docs-tagged
|
|
3
|
+
* corpus stores on tap + the directive to SEARCH them before answering from
|
|
4
|
+
* training data. The reminder-interrupt "announce" half (load-once schema,
|
|
5
|
+
* never a per-turn nag).
|
|
6
|
+
*
|
|
7
|
+
* WHY: the tenant carries vendor/API reference banks (Stripe, QuickBooks,
|
|
8
|
+
* Cloudflare, Procore, Claude Code docs) as corpus stores tagged `api-docs`.
|
|
9
|
+
* An agent that doesn't know they exist answers from stale training data. This
|
|
10
|
+
* surfaces the set once per session, with the one command that searches it.
|
|
11
|
+
*
|
|
12
|
+
* Lean by construction: silent unless the tenant actually has api-docs-tagged
|
|
13
|
+
* stores (env.corpusApiDocs precomputed by the hook). adr: adr/corpus-tags.md */
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.corpusAnnounceModule = void 0;
|
|
16
|
+
exports.buildCorpusAnnounce = buildCorpusAnnounce;
|
|
17
|
+
function buildCorpusAnnounce(names) {
|
|
18
|
+
if (!names || names.length === 0)
|
|
19
|
+
return null;
|
|
20
|
+
const shown = names.slice(0, 8);
|
|
21
|
+
const more = names.length > shown.length ? ` (+${names.length - shown.length} more)` : '';
|
|
22
|
+
return [
|
|
23
|
+
`[greprag corpus — API/reference banks on tap: ${shown.join(', ')}${more}.]`,
|
|
24
|
+
'If a corpus covers the domain you\'re in, SEARCH IT before answering from training data:',
|
|
25
|
+
'`greprag corpus search "<your question>" --tag api-docs` (or --store <name> for one bank).',
|
|
26
|
+
].join('\n');
|
|
27
|
+
}
|
|
28
|
+
exports.corpusAnnounceModule = {
|
|
29
|
+
id: 'corpus-announce',
|
|
30
|
+
detect: (_env) => ({ tier: 'silent' }), // never a per-turn nag
|
|
31
|
+
announce: (env) => buildCorpusAnnounce(env.corpusApiDocs || []),
|
|
32
|
+
reminder: () => null,
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=corpus-reminder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"corpus-reminder.js","sourceRoot":"","sources":["../../src/commands/corpus-reminder.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;kFAWkF;;;AAIlF,kDASC;AATD,SAAgB,mBAAmB,CAAC,KAAe;IACjD,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC9C,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAChC,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1F,OAAO;QACL,iDAAiD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,IAAI;QAC5E,0FAA0F;QAC1F,6FAA6F;KAC9F,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAEY,QAAA,oBAAoB,GAAmB;IAClD,EAAE,EAAE,iBAAiB;IACrB,MAAM,EAAE,CAAC,IAAiB,EAAa,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE,uBAAuB;IACvF,QAAQ,EAAE,CAAC,GAAgB,EAAiB,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC;IAC3F,QAAQ,EAAE,GAAkB,EAAE,CAAC,IAAI;CACpC,CAAC"}
|
|
@@ -13,46 +13,26 @@
|
|
|
13
13
|
* network, no clock — the hook does ALL I/O. Keeping detect/tier a pure function is what
|
|
14
14
|
* makes the detect→silent transition (the auto-stop) unit-testable (the regression-lock). */
|
|
15
15
|
import { Tier, ReminderModule } from './reminder-types';
|
|
16
|
-
/** The firing-tier ladder (docs/reminder-interrupt.md §Firing tiers). `silent`
|
|
17
|
-
* is the off rung; the other three escalate wording intensity with the cost of
|
|
18
|
-
* inaction: ambient = soft pointer, nudge = imperative + reason, nag = LOUD
|
|
19
|
-
* forced-decision. */
|
|
20
16
|
export type FrictionTier = Tier;
|
|
21
|
-
/**
|
|
22
|
-
*
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
*
|
|
32
|
-
* else silent.
|
|
33
|
-
*
|
|
34
|
-
* Defensive: non-finite inputs collapse to 0 (calm / turn 0 → silent), so a
|
|
35
|
-
* missing or corrupt state bag can never escalate — fail-quiet by construction. */
|
|
36
|
-
export declare function frictionReminderTier(turnCount: number, stress: number): FrictionTier;
|
|
37
|
-
/** SessionStart announce — the mechanic-launch schema, loaded ONCE. The heavy
|
|
38
|
-
* half of the pair: it (1) TEACHES the method the per-turn reminder triggers, so
|
|
39
|
-
* the reminder stays a thin pointer, and (2) PRIMES adherence — the agent acts on
|
|
40
|
-
* a reminder for a capability it was *taught*, not a cold mid-session imperative
|
|
41
|
-
* (the no-orphan invariant, docs/reminder-interrupt.md). Written for an AGENT under
|
|
42
|
-
* token pressure per the doc's authoring rules: action-first, reason+method
|
|
43
|
-
* bundled, directive-framed, token-minimal. ~150 tokens; amortized over the
|
|
44
|
-
* session. */
|
|
45
|
-
export declare function buildMechanicAnnounce(): string;
|
|
46
|
-
/** Per-turn reminder line for a given tier — the thin pointer back at the announce
|
|
47
|
-
* schema; null on `silent`. Wording intensity scales with the tier (the doc):
|
|
48
|
-
* ambient = soft pointer, nudge = imperative + reason, nag = LOUD forced-decision.
|
|
49
|
-
* Every non-silent line is action-first, bundles reason+method, and ends on a
|
|
50
|
-
* forced binary (act → spawn / clear → continue) so it CONVERTS instead of becoming
|
|
51
|
-
* wallpaper (the fix-`16a29a8b` banner-blindness failure mode). Grounded to the
|
|
52
|
-
* live signal where there is one (nudge/nag name the stress). The act-now directive
|
|
53
|
-
* envelope (authoring rule #4) is applied by the hook, not here — this module owns
|
|
54
|
-
* the wording, the caller owns the framing. */
|
|
17
|
+
/** The friction reminder fires ONLY on DETECTED STRESS (docs/stress-trigger.md) —
|
|
18
|
+
* no turn-cadence ambient nagging (that was the wallpaper removed 2026-06-22).
|
|
19
|
+
* `computeStress` (the validated AUC-0.835 composite: repetition · retry ·
|
|
20
|
+
* seq-trigram · errors · churn) emits the level; this maps it to a tier:
|
|
21
|
+
* HIGH (2) → nag (LOUD)
|
|
22
|
+
* ELEVATED (1) → nudge (the detector fires pre-error at this band)
|
|
23
|
+
* CALM (0) → silent — the reminder NEVER fires at rest.
|
|
24
|
+
* Defensive: a non-finite stress collapses to calm (fail-quiet). */
|
|
25
|
+
export declare function frictionReminderTier(stress: number): FrictionTier;
|
|
26
|
+
/** The per-turn reminder line — fires only on detected stress, points back at the
|
|
27
|
+
* primer's repair vehicles, ends on a forced binary so it converts. null = calm. */
|
|
55
28
|
export declare function buildFrictionReminder(tier: FrictionTier): string | null;
|
|
29
|
+
/** SessionStart primer — the active-Mechanic schema, loaded ONCE. Full doctrine
|
|
30
|
+
* inline (a PRIMER, not a pointer): it teaches WHEN friction is a fix-now signal,
|
|
31
|
+
* the two repair vehicles (reflex vs workshop, by friction tier), and the modes.
|
|
32
|
+
* Depends on the chip concept being loaded first (chip-spawn-pointer) — it names
|
|
33
|
+
* chip vehicles. Written for an agent under token pressure: action-first,
|
|
34
|
+
* reason+method bundled, no per-turn nag to lean on. */
|
|
35
|
+
export declare function buildMechanicAnnounce(): string;
|
|
56
36
|
/** Persisted fire-counter (docs/reminder-interrupt.md §Measurement). The
|
|
57
37
|
* DENOMINATOR of the adherence ratio: how many friction reminders were shown, by
|
|
58
38
|
* tier. The numerator (reflex chips actually spawned after a reminder) is the next
|
|
@@ -83,10 +63,8 @@ export declare function tallyFrictionFire(prior: FrictionStats | null, tier: Fri
|
|
|
83
63
|
* path calls this when it sees a chip preloaded from the reflex-chip template land
|
|
84
64
|
* after a reminder. Never decrements; idempotency is the caller's concern. */
|
|
85
65
|
export declare function tallyReflexSpawn(prior: FrictionStats | null): FrictionStats;
|
|
86
|
-
/** The active Mechanic
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
* watcher-arm reference module (binary, auto-silences when armed), this one is
|
|
91
|
-
* GRADED — silent at calm, escalating with the live stress level. */
|
|
66
|
+
/** The active Mechanic — a PRIMER-ONLY module (docs/load-system.md): one strong
|
|
67
|
+
* SessionStart announce, no per-turn reminder (the friction nag was removed
|
|
68
|
+
* 2026-06-22 as wallpaper). `dependsOn` the chip-spawn pointer so the chip concept
|
|
69
|
+
* it references is already loaded — the boot sequence places it AFTER chips. */
|
|
92
70
|
export declare const mechanicFrictionModule: ReminderModule;
|
|
@@ -14,82 +14,64 @@
|
|
|
14
14
|
* network, no clock — the hook does ALL I/O. Keeping detect/tier a pure function is what
|
|
15
15
|
* makes the detect→silent transition (the auto-stop) unit-testable (the regression-lock). */
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.mechanicFrictionModule =
|
|
17
|
+
exports.mechanicFrictionModule = void 0;
|
|
18
18
|
exports.frictionReminderTier = frictionReminderTier;
|
|
19
|
-
exports.buildMechanicAnnounce = buildMechanicAnnounce;
|
|
20
19
|
exports.buildFrictionReminder = buildFrictionReminder;
|
|
20
|
+
exports.buildMechanicAnnounce = buildMechanicAnnounce;
|
|
21
21
|
exports.tallyFrictionFire = tallyFrictionFire;
|
|
22
22
|
exports.tallyReflexSpawn = tallyReflexSpawn;
|
|
23
23
|
const state_trigger_1 = require("./state-trigger");
|
|
24
|
-
/**
|
|
25
|
-
*
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
|
|
33
|
-
* stress ELEVATED (1) → nudge — imperative + reason, while elevated.
|
|
34
|
-
* stress CALM (0) → ambient every Nth turn (turnCount % AMBIENT_EVERY_N),
|
|
35
|
-
* else silent.
|
|
36
|
-
*
|
|
37
|
-
* Defensive: non-finite inputs collapse to 0 (calm / turn 0 → silent), so a
|
|
38
|
-
* missing or corrupt state bag can never escalate — fail-quiet by construction. */
|
|
39
|
-
function frictionReminderTier(turnCount, stress) {
|
|
24
|
+
/** The friction reminder fires ONLY on DETECTED STRESS (docs/stress-trigger.md) —
|
|
25
|
+
* no turn-cadence ambient nagging (that was the wallpaper removed 2026-06-22).
|
|
26
|
+
* `computeStress` (the validated AUC-0.835 composite: repetition · retry ·
|
|
27
|
+
* seq-trigram · errors · churn) emits the level; this maps it to a tier:
|
|
28
|
+
* HIGH (2) → nag (LOUD)
|
|
29
|
+
* ELEVATED (1) → nudge (the detector fires pre-error at this band)
|
|
30
|
+
* CALM (0) → silent — the reminder NEVER fires at rest.
|
|
31
|
+
* Defensive: a non-finite stress collapses to calm (fail-quiet). */
|
|
32
|
+
function frictionReminderTier(stress) {
|
|
40
33
|
const s = Number.isFinite(stress) ? stress : 0;
|
|
41
|
-
const t = Number.isFinite(turnCount) ? turnCount : 0;
|
|
42
34
|
if (s >= state_trigger_1.STRESS_HIGH)
|
|
43
35
|
return 'nag';
|
|
44
36
|
if (s >= state_trigger_1.STRESS_ELEVATED)
|
|
45
37
|
return 'nudge';
|
|
46
|
-
if (t >= 1 && t % exports.AMBIENT_EVERY_N === 0)
|
|
47
|
-
return 'ambient';
|
|
48
38
|
return 'silent';
|
|
49
39
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
* announce and the per-turn line can never drift on the spawn mechanic. */
|
|
53
|
-
const SPAWN_METHOD = 'spawn a fire-and-forget reflex chip (spawn_task → packages/cli/skill/templates/reflex-chip.md)';
|
|
54
|
-
/** SessionStart announce — the mechanic-launch schema, loaded ONCE. The heavy
|
|
55
|
-
* half of the pair: it (1) TEACHES the method the per-turn reminder triggers, so
|
|
56
|
-
* the reminder stays a thin pointer, and (2) PRIMES adherence — the agent acts on
|
|
57
|
-
* a reminder for a capability it was *taught*, not a cold mid-session imperative
|
|
58
|
-
* (the no-orphan invariant, docs/reminder-interrupt.md). Written for an AGENT under
|
|
59
|
-
* token pressure per the doc's authoring rules: action-first, reason+method
|
|
60
|
-
* bundled, directive-framed, token-minimal. ~150 tokens; amortized over the
|
|
61
|
-
* session. */
|
|
62
|
-
function buildMechanicAnnounce() {
|
|
63
|
-
return [
|
|
64
|
-
'[Active Mechanic — keep the harness healthy IN-SESSION. Friction is a signal to fix now, not to defer.]',
|
|
65
|
-
'WHEN you hit friction this session — repeated yourself, fought a tool, got corrected ≥2× on the same thing, or rediscovered something already known — fix the PATTERN now; do not push through.',
|
|
66
|
-
`HOW: ${SPAWN_METHOD}. The chip is preloaded with the mechanic tools + live \`greprag mechanic status\`, so it orients instantly, lands a Tier-0 born-shadow repair, and ends — no gate to wait at.`,
|
|
67
|
-
'MODES: fix (land the repair) · log (`greprag fix log "<obs>"` when it is a mechanism for /mechanic later) · ask-human (the operator must decide).',
|
|
68
|
-
'WHY now: immediate-fix beats the backlog — the moment that produced the friction still holds the context the fix needs; deferred, that context is gone.',
|
|
69
|
-
'A per-turn reminder fires LOUD when live friction is detected — act on it, or say "clear" and continue.',
|
|
70
|
-
].join('\n');
|
|
71
|
-
}
|
|
72
|
-
/** Per-turn reminder line for a given tier — the thin pointer back at the announce
|
|
73
|
-
* schema; null on `silent`. Wording intensity scales with the tier (the doc):
|
|
74
|
-
* ambient = soft pointer, nudge = imperative + reason, nag = LOUD forced-decision.
|
|
75
|
-
* Every non-silent line is action-first, bundles reason+method, and ends on a
|
|
76
|
-
* forced binary (act → spawn / clear → continue) so it CONVERTS instead of becoming
|
|
77
|
-
* wallpaper (the fix-`16a29a8b` banner-blindness failure mode). Grounded to the
|
|
78
|
-
* live signal where there is one (nudge/nag name the stress). The act-now directive
|
|
79
|
-
* envelope (authoring rule #4) is applied by the hook, not here — this module owns
|
|
80
|
-
* the wording, the caller owns the framing. */
|
|
40
|
+
/** The per-turn reminder line — fires only on detected stress, points back at the
|
|
41
|
+
* primer's repair vehicles, ends on a forced binary so it converts. null = calm. */
|
|
81
42
|
function buildFrictionReminder(tier) {
|
|
82
43
|
switch (tier) {
|
|
83
44
|
case 'nag':
|
|
84
|
-
return
|
|
45
|
+
return '⚠ FRICTION HIGH (live signal: repetition / errors / churn) — STOP pushing through; fix the PATTERN now → `greprag load reflex-chip` (sentence-tier) or `greprag load workshop-chip` (machinery), then spawn_task. No friction? say "clear" + continue.';
|
|
85
46
|
case 'nudge':
|
|
86
|
-
return
|
|
87
|
-
case 'ambient':
|
|
88
|
-
return `💡 Hit friction since the last check (repeated yourself, fought a tool, corrected ≥2×)? → ${SPAWN_METHOD}. If not, say "clear" + continue.`;
|
|
47
|
+
return '⚠ Friction detected (live signal) — if you have repeated yourself, fought a tool, or hit a wall, fix the PATTERN now → `greprag load reflex-chip` (sentence-tier) or `greprag load workshop-chip` (machinery), then spawn_task. Otherwise say "clear" + continue.';
|
|
89
48
|
default:
|
|
90
49
|
return null;
|
|
91
50
|
}
|
|
92
51
|
}
|
|
52
|
+
// ---------- The Mechanic primer (announce-only) ------------------------------
|
|
53
|
+
/** The method the primer points at. `greprag load reflex-chip` carries the full
|
|
54
|
+
* in-the-moment repair-chip schema; `greprag load workshop-chip` the heavier
|
|
55
|
+
* mechanism-tier one. Kept in one place so the two branches never drift. */
|
|
56
|
+
const REFLEX_METHOD = 'spawn a fire-and-forget reflex chip — `greprag load reflex-chip` for the method, then `spawn_task`';
|
|
57
|
+
const WORKSHOP_METHOD = 'spawn a workshop chip — `greprag load workshop-chip` (investigates + drafts the repair, parks at your merge gate)';
|
|
58
|
+
/** SessionStart primer — the active-Mechanic schema, loaded ONCE. Full doctrine
|
|
59
|
+
* inline (a PRIMER, not a pointer): it teaches WHEN friction is a fix-now signal,
|
|
60
|
+
* the two repair vehicles (reflex vs workshop, by friction tier), and the modes.
|
|
61
|
+
* Depends on the chip concept being loaded first (chip-spawn-pointer) — it names
|
|
62
|
+
* chip vehicles. Written for an agent under token pressure: action-first,
|
|
63
|
+
* reason+method bundled, no per-turn nag to lean on. */
|
|
64
|
+
function buildMechanicAnnounce() {
|
|
65
|
+
return [
|
|
66
|
+
'[Active Mechanic — keep the harness healthy IN-SESSION. Friction is a signal to fix NOW, not to defer; the moment that produced it still holds the context the fix needs.]',
|
|
67
|
+
'WHEN you hit friction this session — repeated yourself, fought a tool, got corrected ≥2× on the same thing, or rediscovered something already known — fix the PATTERN now; do not push through.',
|
|
68
|
+
`SENTENCE-TIER friction (the fix is words in a file you own — a skill / doc / CLAUDE.md): ${REFLEX_METHOD}. The chip is preloaded with the mechanic tools + live \`greprag mechanic status\`, lands a Tier-0 born-shadow repair, and ends — no gate to wait at.`,
|
|
69
|
+
`MECHANISM-TIER friction (the fix is machinery — a hook / gate / trigger / code, anything you can't fix in words): ${WORKSHOP_METHOD}.`,
|
|
70
|
+
'MODES (when unsure which, or when it is not a chip): fix (land the repair inline) · log (`greprag fix log "<obs>"` to queue it for /mechanic) · ask-human (the operator must decide).',
|
|
71
|
+
'Every repair is ROOT-CAUSE — fix the pattern that makes the friction class possible, never a guard on today\'s trigger.',
|
|
72
|
+
'A per-turn reminder fires ONLY when live friction is DETECTED (the stress signal — repetition / errors / churn), never on a timer — act on it, or say "clear" and continue.',
|
|
73
|
+
].join('\n');
|
|
74
|
+
}
|
|
93
75
|
/** Normalize any prior-stats blob (possibly missing/partial/corrupt) into a fully
|
|
94
76
|
* populated FrictionStats. Pure, total. */
|
|
95
77
|
function normalizeStats(prior) {
|
|
@@ -132,15 +114,15 @@ function tallyReflexSpawn(prior) {
|
|
|
132
114
|
return s;
|
|
133
115
|
}
|
|
134
116
|
// ---------- Registry module --------------------------------------------------
|
|
135
|
-
/** The active Mechanic
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
* watcher-arm reference module (binary, auto-silences when armed), this one is
|
|
140
|
-
* GRADED — silent at calm, escalating with the live stress level. */
|
|
117
|
+
/** The active Mechanic — a PRIMER-ONLY module (docs/load-system.md): one strong
|
|
118
|
+
* SessionStart announce, no per-turn reminder (the friction nag was removed
|
|
119
|
+
* 2026-06-22 as wallpaper). `dependsOn` the chip-spawn pointer so the chip concept
|
|
120
|
+
* it references is already loaded — the boot sequence places it AFTER chips. */
|
|
141
121
|
exports.mechanicFrictionModule = {
|
|
142
122
|
id: 'mechanic-friction',
|
|
143
|
-
|
|
123
|
+
dependsOn: ['chip-spawn-pointer'],
|
|
124
|
+
// Fires ONLY on detected stress (elevated/high) — no turn-cadence nag.
|
|
125
|
+
detect: (env) => ({ tier: frictionReminderTier(env.stress) }),
|
|
144
126
|
announce: () => buildMechanicAnnounce(),
|
|
145
127
|
reminder: (d) => buildFrictionReminder(d.tier),
|
|
146
128
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"friction-reminder.js","sourceRoot":"","sources":["../../src/commands/friction-reminder.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;8FAa8F;;;
|
|
1
|
+
{"version":3,"file":"friction-reminder.js","sourceRoot":"","sources":["../../src/commands/friction-reminder.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;8FAa8F;;;AAe9F,oDAKC;AAID,sDASC;AAkBD,sDAUC;AA6CD,8CAWC;AAKD,4CAIC;AA5HD,mDAA+D;AAK/D;;;;;;;qEAOqE;AACrE,SAAgB,oBAAoB,CAAC,MAAc;IACjD,MAAM,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/C,IAAI,CAAC,IAAI,2BAAW;QAAE,OAAO,KAAK,CAAC;IACnC,IAAI,CAAC,IAAI,+BAAe;QAAE,OAAO,OAAO,CAAC;IACzC,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;qFACqF;AACrF,SAAgB,qBAAqB,CAAC,IAAkB;IACtD,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,KAAK;YACR,OAAO,wPAAwP,CAAC;QAClQ,KAAK,OAAO;YACV,OAAO,mQAAmQ,CAAC;QAC7Q;YACE,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC;AAED,gFAAgF;AAEhF;;6EAE6E;AAC7E,MAAM,aAAa,GACjB,oGAAoG,CAAC;AACvG,MAAM,eAAe,GACnB,mHAAmH,CAAC;AAEtH;;;;;yDAKyD;AACzD,SAAgB,qBAAqB;IACnC,OAAO;QACL,4KAA4K;QAC5K,iMAAiM;QACjM,4FAA4F,aAAa,uJAAuJ;QAChQ,qHAAqH,eAA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
300
|
optionalSkills.push(entry.name);
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
|
-
// Step 6b
|
|
304
|
-
//
|
|
305
|
-
//
|
|
306
|
-
//
|
|
307
|
-
//
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
if (fs.existsSync(chipSpawnSrc)) {
|
|
311
|
-
if (!fs.existsSync(docsDir))
|
|
312
|
-
fs.mkdirSync(docsDir, { recursive: true });
|
|
313
|
-
const chipSpawnDest = path.join(docsDir, 'chip-spawn.md');
|
|
314
|
-
fs.copyFileSync(chipSpawnSrc, chipSpawnDest);
|
|
315
|
-
changes.push(`Installed chip-spawn doc → ${chipSpawnDest}`);
|
|
316
|
-
}
|
|
303
|
+
// Step 6b RETIRED 2026-06-22 (docs/load-system.md): the chip-spawn protocol is
|
|
304
|
+
// no longer copied to ~/.claude/docs/chip-spawn.md. greprag function never
|
|
305
|
+
// depends on a `.md` file on disk — the doctrine ships in the binary and is
|
|
306
|
+
// loaded on demand via `greprag load chip-spawn` (the Interrupt System's
|
|
307
|
+
// chip-spawn POINTER announce names the trigger + the command). One less
|
|
308
|
+
// install-time file write, and it works in every project, not just where the
|
|
309
|
+
// file happened to be installed.
|
|
317
310
|
// Step 7: Patch ~/.claude/CLAUDE.md greprag CLI section (migrates legacy ## Inbox).
|
|
318
311
|
const claudeMdPatched = patchGlobalClaudeMd();
|
|
319
312
|
changes.push(claudeMdPatched ? 'Patched ~/.claude/CLAUDE.md greprag CLI section' : '~/.claude/CLAUDE.md greprag CLI section already up to date');
|