greprag 5.13.0 → 5.15.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 +7 -6
- package/dist/commands/checkpoint-helpers.js +4 -1
- package/dist/commands/checkpoint-helpers.js.map +1 -1
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.js +270 -2
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/lore.js +7 -5
- package/dist/commands/lore.js.map +1 -1
- package/dist/commands/memory.d.ts +31 -0
- package/dist/commands/memory.js +514 -0
- package/dist/commands/memory.js.map +1 -0
- package/dist/commands/project.d.ts +16 -0
- package/dist/commands/project.js +430 -0
- package/dist/commands/project.js.map +1 -0
- package/dist/hook.d.ts +1 -1
- package/dist/hook.js +9 -10
- package/dist/hook.js.map +1 -1
- package/dist/index.js +57 -19
- package/dist/index.js.map +1 -1
- package/dist/project-anchor.d.ts +1 -1
- package/dist/project-anchor.js +1 -1
- package/dist/session-id.d.ts +30 -25
- package/dist/session-id.js +39 -33
- package/dist/session-id.js.map +1 -1
- package/package.json +2 -1
- package/plugin/.claude-plugin/marketplace.json +13 -0
- package/plugin/plugins/greprag-inbox/.claude-plugin/plugin.json +7 -0
- package/plugin/plugins/greprag-inbox/monitors/monitors.json +8 -0
- package/skill/commander/SKILL.md +2 -2
- package/skill/content-advisor/SKILL.md +1 -1
- package/skill/greprag/SKILL.md +61 -661
- package/skill/greprag/docs/corpus.md +98 -0
- package/skill/greprag/docs/discord-handoff.md +47 -0
- package/skill/greprag/docs/discover.md +28 -0
- package/skill/greprag/docs/doctor.md +22 -0
- package/skill/greprag/docs/inbox-watch.md +57 -0
- package/skill/greprag/docs/inbox.md +100 -0
- package/skill/greprag/docs/lore.md +70 -0
- package/skill/greprag/docs/memory-advanced.md +23 -0
- package/skill/greprag/docs/per-project-flags.md +14 -0
- package/skill/greprag/docs/setup.md +208 -0
package/dist/session-id.js
CHANGED
|
@@ -44,6 +44,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
44
44
|
})();
|
|
45
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
46
|
exports.truncateSessionId = truncateSessionId;
|
|
47
|
+
exports.sessionIdFromEnv = sessionIdFromEnv;
|
|
47
48
|
exports.readIdentityAlias = readIdentityAlias;
|
|
48
49
|
exports.buildSessionIdContext = buildSessionIdContext;
|
|
49
50
|
exports.handleSessionIdHook = handleSessionIdHook;
|
|
@@ -65,6 +66,25 @@ function truncateSessionId(sessionId) {
|
|
|
65
66
|
const candidate = hex.slice(0, 8);
|
|
66
67
|
return /^[0-9a-f]{8}$/.test(candidate) ? candidate : null;
|
|
67
68
|
}
|
|
69
|
+
/** Resolve the running session's id from the environment, truncated to 8-hex.
|
|
70
|
+
*
|
|
71
|
+
* Claude Code sets `CLAUDE_CODE_SESSION_ID` on every subprocess it spawns —
|
|
72
|
+
* the Bash tool, hook processes, AND plugin monitors all inherit it (verified
|
|
73
|
+
* against the 2.1.x binary: the child-env builder sets it unconditionally and
|
|
74
|
+
* it is also written to the global process env). So any greprag command run
|
|
75
|
+
* inside a session self-discovers its own id with no flag and no transcript
|
|
76
|
+
* spelunking. `CLAUDE_SESSION_ID` / `GREPRAG_SESSION_ID` are kept as
|
|
77
|
+
* back-compat / test-injection fallbacks. Returns null when none is set or
|
|
78
|
+
* the value can't be truncated to a valid 8-hex id.
|
|
79
|
+
*
|
|
80
|
+
* Note: the env var is `CLAUDE_CODE_SESSION_ID` (with `CODE`); the legacy
|
|
81
|
+
* `CLAUDE_SESSION_ID` name was never actually set by Claude Code. */
|
|
82
|
+
function sessionIdFromEnv() {
|
|
83
|
+
return truncateSessionId(process.env.CLAUDE_CODE_SESSION_ID
|
|
84
|
+
|| process.env.CLAUDE_SESSION_ID
|
|
85
|
+
|| process.env.GREPRAG_SESSION_ID
|
|
86
|
+
|| null);
|
|
87
|
+
}
|
|
68
88
|
/** Read the cached identity handle. Returns the alias part (before `@`) so
|
|
69
89
|
* it can be substituted in `<handle>@greprag.com/<id>` templates without
|
|
70
90
|
* doubling the domain. Returns null on any read/parse error — caller
|
|
@@ -92,52 +112,38 @@ function readIdentityAlias() {
|
|
|
92
112
|
/** Build the `additionalContext` body. Kept as a named export so tests
|
|
93
113
|
* can assert on shape without going through stdin/stdout.
|
|
94
114
|
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* `ARM YOUR INBOX WATCHER NOW.` lead was skipped in practice — agents
|
|
102
|
-
* treated it as informational rather than as a precondition. STOP +
|
|
103
|
-
* RUN combines two imperatives models react to strongly (stop reading
|
|
104
|
-
* past, do this thing now), and `RUN THIS NOW:` sits immediately
|
|
105
|
-
* before the actual command so the action is structurally adjacent to
|
|
106
|
-
* its trigger phrase. The agent can infer the command's role from
|
|
107
|
-
* reading it (`greprag inbox watch` + the reply-to line on the next
|
|
108
|
-
* sentence ties messages to the same address) — no need to label.
|
|
115
|
+
* Emits awareness only: the agent's own 8-hex session id plus the
|
|
116
|
+
* two-segment reply-to address (grammar per adr/address-grammar.md),
|
|
117
|
+
* grounded in *this* session's id so the agent copy/pastes rather than
|
|
118
|
+
* composes. `alias` substitutes the literal `<handle>` placeholder in the
|
|
119
|
+
* reply-address line; defaults to null (leave placeholder) for callers
|
|
120
|
+
* without an identity cache.
|
|
109
121
|
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
|
|
122
|
+
* Arming the inbox watcher is NO LONGER done here. The old SessionStart
|
|
123
|
+
* arm-directive (`STOP IMMEDIATELY ... RUN THIS NOW: Monitor ...`) depended
|
|
124
|
+
* on the agent choosing to make a Monitor tool call and was skipped in
|
|
125
|
+
* practice. It is replaced by the `greprag-inbox` plugin monitor, which
|
|
126
|
+
* Claude Code auto-starts at session start with no agent cooperation —
|
|
127
|
+
* see adr/session-id-awareness.md. */
|
|
128
|
+
function buildSessionIdContext(short, alias = null) {
|
|
114
129
|
const handle = alias || '<handle>';
|
|
115
|
-
|
|
130
|
+
return (`Your greprag session id: ${short}. `
|
|
116
131
|
+ `Reply to you: ${handle}@greprag.com/${short} `
|
|
117
132
|
+ `(target = 8-hex/UUID session id, or project name).`);
|
|
118
|
-
if (!armWatcher)
|
|
119
|
-
return ref;
|
|
120
|
-
return (`STOP IMMEDIATELY AND READ THIS. RUN THIS NOW: `
|
|
121
|
-
+ `Monitor (persistent:true): `
|
|
122
|
-
+ `\`while true; do greprag inbox watch --session ${short} --json; `
|
|
123
|
-
+ `echo "[restart]" >&2; sleep 1; done\`. `
|
|
124
|
-
+ ref);
|
|
125
133
|
}
|
|
126
134
|
/** Handle `greprag-hook session-id`. Reads the Claude Code hook payload
|
|
127
135
|
* from `input.session_id`, emits a JSON response with hookSpecificOutput.
|
|
128
136
|
* additionalContext to stdout. Silent on missing session_id (other hook
|
|
129
137
|
* entries in the chain still fire).
|
|
130
138
|
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* both set — no point telling an unconfigured project to arm a watcher
|
|
135
|
-
* that would just loop on auth errors.
|
|
139
|
+
* Emits session-id awareness only. Arming the inbox watcher moved to the
|
|
140
|
+
* `greprag-inbox` plugin monitor (see buildSessionIdContext +
|
|
141
|
+
* adr/session-id-awareness.md).
|
|
136
142
|
*
|
|
137
143
|
* Reads the identity alias from `~/.greprag/identity.json` here so the
|
|
138
144
|
* emitted reply-address line carries the operator's real handle instead
|
|
139
145
|
* of the literal `<handle>` placeholder. */
|
|
140
|
-
function handleSessionIdHook(input
|
|
146
|
+
function handleSessionIdHook(input) {
|
|
141
147
|
const short = truncateSessionId(input.session_id);
|
|
142
148
|
if (!short)
|
|
143
149
|
return;
|
|
@@ -145,7 +151,7 @@ function handleSessionIdHook(input, opts = {}) {
|
|
|
145
151
|
const payload = {
|
|
146
152
|
hookSpecificOutput: {
|
|
147
153
|
hookEventName: 'SessionStart',
|
|
148
|
-
additionalContext: buildSessionIdContext(short,
|
|
154
|
+
additionalContext: buildSessionIdContext(short, alias),
|
|
149
155
|
},
|
|
150
156
|
};
|
|
151
157
|
process.stdout.write(JSON.stringify(payload) + '\n');
|
package/dist/session-id.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-id.js","sourceRoot":"","sources":["../src/session-id.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYH,8CAMC;AASD,8CAaC;
|
|
1
|
+
{"version":3,"file":"session-id.js","sourceRoot":"","sources":["../src/session-id.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYH,8CAMC;AAeD,4CAOC;AASD,8CAaC;AAkBD,sDAUC;AAcD,kDAaC;AAnHD,2CAA6B;AAC7B,uCAAyB;AAEzB;;;;;;4CAM4C;AAC5C,SAAgB,iBAAiB,CAAC,SAAoC;IACpE,IAAI,CAAC,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC7D,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IACtD,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAChC,MAAM,SAAS,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAClC,OAAO,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5D,CAAC;AAED;;;;;;;;;;;;sEAYsE;AACtE,SAAgB,gBAAgB;IAC9B,OAAO,iBAAiB,CACtB,OAAO,CAAC,GAAG,CAAC,sBAAsB;WAC/B,OAAO,CAAC,GAAG,CAAC,iBAAiB;WAC7B,OAAO,CAAC,GAAG,CAAC,kBA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GAAG,iBAAiB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAClD,IAAI,CAAC,KAAK;QAAE,OAAO;IACnB,MAAM,KAAK,GAAG,iBAAiB,EAAE,CAAC;IAClC,MAAM,OAAO,GAAG;QACd,kBAAkB,EAAE;YAClB,aAAa,EAAE,cAAc;YAC7B,iBAAiB,EAAE,qBAAqB,CAAC,KAAK,EAAE,KAAK,CAAC;SACvD;KACF,CAAC;IACF,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;AACvD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "greprag",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.15.0",
|
|
4
4
|
"description": "GrepRAG — agent memory for Claude Code. 2-command setup.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"files": [
|
|
16
16
|
"dist",
|
|
17
17
|
"skill",
|
|
18
|
+
"plugin",
|
|
18
19
|
"scripts"
|
|
19
20
|
],
|
|
20
21
|
"devDependencies": {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "greprag",
|
|
3
|
+
"owner": { "name": "GrepRAG", "email": "travis@greprag.com" },
|
|
4
|
+
"metadata": { "description": "GrepRAG bundled plugins." },
|
|
5
|
+
"plugins": [
|
|
6
|
+
{
|
|
7
|
+
"name": "greprag-inbox",
|
|
8
|
+
"description": "Auto-arms the GrepRAG inbox watcher (session-scoped) at session start so cross-session messages arrive mid-task without the agent invoking anything.",
|
|
9
|
+
"source": "./plugins/greprag-inbox",
|
|
10
|
+
"category": "productivity"
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "greprag-inbox-watch",
|
|
4
|
+
"when": "always",
|
|
5
|
+
"description": "GrepRAG inbox (session-scoped live tail)",
|
|
6
|
+
"command": "while true; do greprag inbox watch --session-from-env --json; echo '[greprag inbox watch] watcher exited, restarting in 1s' >&2; sleep 1; done"
|
|
7
|
+
}
|
|
8
|
+
]
|
package/skill/commander/SKILL.md
CHANGED
|
@@ -124,9 +124,9 @@ If `references.discord.emergency_route` is non-null, this session was auto-linke
|
|
|
124
124
|
|
|
125
125
|
Example first reply:
|
|
126
126
|
|
|
127
|
-
> Picked this up in `<project-name>` / session `<session-8hex>` (no handoff was active, so I'm the most-
|
|
127
|
+
> Picked this up in `<project-name>` / session `<session-8hex>` (no handoff was active, so I'm the most-recently-active armed session). Auto-pin is 10 min; it extends to 30 once you reply again. Want to redirect? `/commander handoff` from another session, or just say "redirect to <project>".
|
|
128
128
|
|
|
129
|
-
The auto-pin
|
|
129
|
+
How the bot chose this session: among all armed session-scoped watchers under your tenant, it picks the **most-recently-active** one — ranked by `max(last turn end, arm time)` — so a session that just finished a turn (idle, waiting) outranks one grinding a long task or gone dark. The auto-pin starts at a **genuine 10-min leash**, so one stray DM into the wrong session self-heals fast if you go quiet; your *next* DM (pin now live) extends it to ≥30 min so a real back-and-forth keeps flowing here. If the picked session turns out to be dead — or nothing is armed at all — the bot replies that your message is filed and will be delivered the moment a session reconnects (it never vanishes), and clears the dead auto-pin so the next DM re-runs the router.
|
|
130
130
|
|
|
131
131
|
For long agent turns where you're drafting >10s, refresh the typing indicator between work steps:
|
|
132
132
|
|
|
@@ -3,7 +3,7 @@ name: content-advisor
|
|
|
3
3
|
version: 0.1.0
|
|
4
4
|
description: |
|
|
5
5
|
Cross-venture content strategist for a multi-venture portfolio. Reads
|
|
6
|
-
GrepRAG
|
|
6
|
+
GrepRAG memory (episodic project memory; marketed as Odyssey — ship-events, dailies, weeklies) across every
|
|
7
7
|
paired project, cross-checks recent writing activity (OpenWriter drafts,
|
|
8
8
|
newsletter sends, X posts, blog commits), and produces a ranked list of
|
|
9
9
|
the next content pieces to ship — each one ready to hand off to a
|