@possumtech/rummy 0.2.8 → 0.3.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/.env.example +11 -1
- package/EXCEPTIONS.md +46 -0
- package/PLUGINS.md +422 -188
- package/SPEC.md +284 -93
- package/migrations/001_initial_schema.sql +6 -4
- package/package.json +13 -5
- package/src/agent/AgentLoop.js +166 -15
- package/src/agent/ContextAssembler.js +18 -4
- package/src/agent/KnownStore.js +127 -13
- package/src/agent/ProjectAgent.js +4 -1
- package/src/agent/ResponseHealer.js +21 -1
- package/src/agent/TurnExecutor.js +365 -175
- package/src/agent/XmlParser.js +72 -39
- package/src/agent/known_store.sql +20 -4
- package/src/agent/schemes.sql +3 -0
- package/src/agent/tokens.js +6 -21
- package/src/agent/turns.sql +10 -1
- package/src/hooks/Hooks.js +18 -0
- package/src/hooks/PluginContext.js +14 -1
- package/src/hooks/RummyContext.js +16 -4
- package/src/hooks/ToolRegistry.js +83 -19
- package/src/llm/LlmProvider.js +27 -8
- package/src/llm/OpenAiClient.js +20 -0
- package/src/llm/OpenRouterClient.js +24 -2
- package/src/llm/XaiClient.js +47 -2
- package/src/plugins/ask_user/README.md +4 -4
- package/src/plugins/ask_user/ask_user.js +5 -5
- package/src/plugins/ask_user/ask_userDoc.js +29 -0
- package/src/plugins/budget/BudgetGuard.js +74 -0
- package/src/plugins/budget/README.md +43 -0
- package/src/plugins/budget/budget.js +79 -0
- package/src/plugins/cp/README.md +5 -4
- package/src/plugins/cp/cp.js +10 -6
- package/src/plugins/cp/cpDoc.js +29 -0
- package/src/plugins/current/README.md +4 -4
- package/src/plugins/current/current.js +9 -6
- package/src/plugins/engine/engine.sql +1 -8
- package/src/plugins/engine/turn_context.sql +4 -9
- package/src/plugins/env/README.md +3 -4
- package/src/plugins/env/env.js +5 -5
- package/src/plugins/env/envDoc.js +29 -0
- package/src/plugins/file/README.md +9 -12
- package/src/plugins/file/file.js +34 -35
- package/src/plugins/get/README.md +2 -2
- package/src/plugins/get/get.js +6 -5
- package/src/plugins/get/getDoc.js +41 -0
- package/src/plugins/hedberg/hedberg.js +2 -1
- package/src/plugins/hedberg/normalize.js +28 -0
- package/src/plugins/hedberg/patterns.js +25 -27
- package/src/plugins/hedberg/sed.js +17 -10
- package/src/plugins/index.js +66 -14
- package/src/plugins/instructions/README.md +6 -2
- package/src/plugins/instructions/instructions.js +20 -4
- package/src/plugins/instructions/preamble.md +9 -5
- package/src/plugins/known/README.md +10 -7
- package/src/plugins/known/known.js +29 -17
- package/src/plugins/known/knownDoc.js +33 -0
- package/src/plugins/mv/README.md +5 -4
- package/src/plugins/mv/mv.js +10 -6
- package/src/plugins/mv/mvDoc.js +31 -0
- package/src/plugins/persona/persona.js +78 -0
- package/src/plugins/previous/README.md +2 -2
- package/src/plugins/previous/previous.js +9 -6
- package/src/plugins/progress/progress.js +41 -15
- package/src/plugins/prompt/README.md +5 -5
- package/src/plugins/prompt/prompt.js +18 -13
- package/src/plugins/rm/README.md +4 -4
- package/src/plugins/rm/rm.js +5 -5
- package/src/plugins/rm/rmDoc.js +30 -0
- package/src/plugins/rpc/README.md +15 -28
- package/src/plugins/rpc/rpc.js +42 -77
- package/src/plugins/set/README.md +13 -12
- package/src/plugins/set/set.js +60 -5
- package/src/plugins/set/setDoc.js +45 -0
- package/src/plugins/sh/README.md +4 -4
- package/src/plugins/sh/sh.js +5 -5
- package/src/plugins/sh/shDoc.js +29 -0
- package/src/plugins/{skills/skills.js → skill/skill.js} +10 -51
- package/src/plugins/summarize/README.md +6 -5
- package/src/plugins/summarize/summarize.js +7 -6
- package/src/plugins/summarize/summarizeDoc.js +33 -0
- package/src/plugins/telemetry/telemetry.js +3 -1
- package/src/plugins/think/README.md +20 -0
- package/src/plugins/think/think.js +5 -0
- package/src/plugins/unknown/README.md +5 -5
- package/src/plugins/unknown/unknown.js +9 -7
- package/src/plugins/unknown/unknownDoc.js +31 -0
- package/src/plugins/update/README.md +3 -8
- package/src/plugins/update/update.js +7 -6
- package/src/plugins/update/updateDoc.js +33 -0
- package/src/server/RpcRegistry.js +52 -4
- package/src/sql/v_model_context.sql +16 -21
- package/src/plugins/ask_user/docs.md +0 -2
- package/src/plugins/cp/docs.md +0 -2
- package/src/plugins/env/docs.md +0 -4
- package/src/plugins/get/docs.md +0 -10
- package/src/plugins/known/docs.md +0 -3
- package/src/plugins/mv/docs.md +0 -2
- package/src/plugins/rm/docs.md +0 -6
- package/src/plugins/set/docs.md +0 -6
- package/src/plugins/sh/docs.md +0 -2
- package/src/plugins/skills/README.md +0 -25
- package/src/plugins/store/README.md +0 -20
- package/src/plugins/store/docs.md +0 -6
- package/src/plugins/store/store.js +0 -63
- package/src/plugins/summarize/docs.md +0 -4
- package/src/plugins/unknown/docs.md +0 -5
- package/src/plugins/update/docs.md +0 -4
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# think
|
|
2
|
+
|
|
3
|
+
Provides a `<think>` tag for model reasoning. Not a tool — does not
|
|
4
|
+
appear in the tool list.
|
|
5
|
+
|
|
6
|
+
## Registration
|
|
7
|
+
|
|
8
|
+
- **Scheme**: `think` — `category: "logging"`, `model_visible: 0`
|
|
9
|
+
- **No handler, no view, no tool registration**
|
|
10
|
+
|
|
11
|
+
## Behavior
|
|
12
|
+
|
|
13
|
+
The model writes `<think>reasoning</think>` before tool commands.
|
|
14
|
+
XmlParser captures it, TurnExecutor records it as a `think://` entry.
|
|
15
|
+
Invisible to the model on subsequent turns (`model_visible: 0`).
|
|
16
|
+
Available for debugging and audit.
|
|
17
|
+
|
|
18
|
+
Models with server-side reasoning (extended thinking) use that
|
|
19
|
+
capability independently. The `<think>` tag is a floor — every model
|
|
20
|
+
gets at least this.
|
|
@@ -7,9 +7,9 @@ The Rumsfeld mechanism. The model registers what it doesn't know before acting.
|
|
|
7
7
|
## Registration
|
|
8
8
|
|
|
9
9
|
- **Tool**: `unknown`
|
|
10
|
-
- **
|
|
11
|
-
- **Category**: structural
|
|
10
|
+
- **Category**: `unknown`
|
|
12
11
|
- **Handler**: None — recorded by TurnExecutor, deduplicated against existing unknowns.
|
|
12
|
+
- **Filter**: `assembly.system` at priority 300 — renders `<unknowns>` section.
|
|
13
13
|
|
|
14
14
|
## Projection
|
|
15
15
|
|
|
@@ -18,6 +18,6 @@ The Rumsfeld mechanism. The model registers what it doesn't know before acting.
|
|
|
18
18
|
## Behavior
|
|
19
19
|
|
|
20
20
|
Unknowns are sticky — they persist across turns until the model explicitly
|
|
21
|
-
|
|
22
|
-
`<env>`, or `<ask_user>`, then removes resolved ones
|
|
23
|
-
|
|
21
|
+
removes them with `<rm>`. The model investigates unknowns using `<get>`,
|
|
22
|
+
`<env>`, or `<ask_user>`, then removes resolved ones. Server deduplicates
|
|
23
|
+
on insert. Turn numbers shown on each unknown for temporal reasoning.
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import
|
|
1
|
+
import docs from "./unknownDoc.js";
|
|
2
2
|
|
|
3
3
|
export default class Unknown {
|
|
4
4
|
#core;
|
|
5
5
|
|
|
6
6
|
constructor(core) {
|
|
7
7
|
this.#core = core;
|
|
8
|
+
core.ensureTool();
|
|
8
9
|
core.registerScheme({
|
|
9
|
-
category: "
|
|
10
|
+
category: "unknown",
|
|
10
11
|
});
|
|
11
12
|
core.on("full", this.full.bind(this));
|
|
12
13
|
core.filter("assembly.system", this.assembleUnknowns.bind(this), 300);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
);
|
|
14
|
+
core.filter("instructions.toolDocs", async (docsMap) => {
|
|
15
|
+
docsMap.unknown = docs;
|
|
16
|
+
return docsMap;
|
|
17
|
+
});
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
full(entry) {
|
|
@@ -25,7 +26,8 @@ export default class Unknown {
|
|
|
25
26
|
if (entries.length === 0) return content;
|
|
26
27
|
|
|
27
28
|
const lines = entries.map(
|
|
28
|
-
(u) =>
|
|
29
|
+
(u) =>
|
|
30
|
+
`<unknown path="${u.path}" turn="${u.source_turn || u.turn}">${u.body}</unknown>`,
|
|
29
31
|
);
|
|
30
32
|
return `${content}\n\n<unknowns>\n${lines.join("\n")}\n</unknowns>`;
|
|
31
33
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Tool doc for <unknown>. Each entry: [text, rationale].
|
|
2
|
+
// Text goes to the model. Rationale stays in source.
|
|
3
|
+
// Changing ANY line requires reading ALL rationales first.
|
|
4
|
+
const LINES = [
|
|
5
|
+
// --- Syntax: body = what you need to learn
|
|
6
|
+
[
|
|
7
|
+
`## <unknown>[specific thing I need to learn]</unknown> - Track open questions`,
|
|
8
|
+
],
|
|
9
|
+
|
|
10
|
+
// --- Examples: concrete unknowns, not abstract
|
|
11
|
+
[
|
|
12
|
+
`Example: <unknown path="unknown://answer">contents of answer.txt</unknown>`,
|
|
13
|
+
`Specific and actionable. Shows that unknowns are concrete investigation targets.`,
|
|
14
|
+
],
|
|
15
|
+
[
|
|
16
|
+
`Example: <unknown>which database adapter is configured</unknown>`,
|
|
17
|
+
`Domain question. Shows unknowns for configuration/architecture questions.`,
|
|
18
|
+
],
|
|
19
|
+
|
|
20
|
+
// --- Lifecycle: register → investigate → resolve
|
|
21
|
+
[
|
|
22
|
+
`* Investigate with Tool Commands`,
|
|
23
|
+
`Cross-tool lifecycle: unknowns drive get/env/ask_user actions.`,
|
|
24
|
+
],
|
|
25
|
+
[
|
|
26
|
+
`* When resolved or irrelevant, remove with <rm path="unknown://..."/>`,
|
|
27
|
+
`Cross-tool lifecycle: rm cleans resolved unknowns from context.`,
|
|
28
|
+
],
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
export default LINES.map(([text]) => text).join("\n");
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
# update
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Lifecycle signal — the model declares it has more work to do.
|
|
4
4
|
|
|
5
5
|
## Registration
|
|
6
6
|
|
|
7
7
|
- **Tool**: `update`
|
|
8
|
-
- **
|
|
9
|
-
- **
|
|
10
|
-
- **Handler**: None — projection only.
|
|
8
|
+
- **Category**: `logging`
|
|
9
|
+
- **Handler**: None — recorded by TurnExecutor as a lifecycle signal.
|
|
11
10
|
|
|
12
11
|
## Projection
|
|
13
12
|
|
|
14
13
|
Shows `update` followed by the entry body.
|
|
15
|
-
|
|
16
|
-
## Behavior
|
|
17
|
-
|
|
18
|
-
No handler logic. Allows the model to emit progress/status entries that appear in context via projection.
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import docs from "./updateDoc.js";
|
|
2
2
|
|
|
3
3
|
export default class Update {
|
|
4
4
|
#core;
|
|
5
5
|
|
|
6
6
|
constructor(core) {
|
|
7
7
|
this.#core = core;
|
|
8
|
-
core.
|
|
8
|
+
core.ensureTool();
|
|
9
|
+
core.registerScheme({ category: "logging" });
|
|
9
10
|
core.on("full", this.full.bind(this));
|
|
10
11
|
core.on("summary", this.summary.bind(this));
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
);
|
|
12
|
+
core.filter("instructions.toolDocs", async (docsMap) => {
|
|
13
|
+
docsMap.update = docs;
|
|
14
|
+
return docsMap;
|
|
15
|
+
});
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
full(entry) {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Tool doc for <update>. Each entry: [text, rationale].
|
|
2
|
+
// Text goes to the model. Rationale stays in source.
|
|
3
|
+
// Changing ANY line requires reading ALL rationales first.
|
|
4
|
+
const LINES = [
|
|
5
|
+
// --- Syntax
|
|
6
|
+
["## <update>[brief status]</update> - Signal continuation"],
|
|
7
|
+
|
|
8
|
+
// --- Examples: research progress and multi-step work
|
|
9
|
+
[
|
|
10
|
+
"Example: <update>Reading config files</update>",
|
|
11
|
+
"Progress checkpoint. Shows update as a status signal, not a log entry.",
|
|
12
|
+
],
|
|
13
|
+
[
|
|
14
|
+
"Example: <update>Found 3 issues, fixing first</update>",
|
|
15
|
+
"Multi-step progress. Shows update for ongoing work.",
|
|
16
|
+
],
|
|
17
|
+
|
|
18
|
+
// --- Constraints: RFC-style MUST/MUST NOT
|
|
19
|
+
[
|
|
20
|
+
"* YOU MUST use <update> if still working — describes the current state",
|
|
21
|
+
"Continuation signal. Triggers the next turn in the loop.",
|
|
22
|
+
],
|
|
23
|
+
[
|
|
24
|
+
"* YOU MUST NOT use <update> if done — use <summarize/> instead",
|
|
25
|
+
"Mutual exclusion with summarize. Prevents infinite loops.",
|
|
26
|
+
],
|
|
27
|
+
[
|
|
28
|
+
"* YOU MUST keep <update> to <= 80 characters",
|
|
29
|
+
"Length cap. Prevents models from writing essays in status updates.",
|
|
30
|
+
],
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
export default LINES.map(([text]) => text).join("\n");
|
|
@@ -12,8 +12,6 @@ export default class RpcRegistry {
|
|
|
12
12
|
longRunning = false,
|
|
13
13
|
},
|
|
14
14
|
) {
|
|
15
|
-
if (this.#methods.has(name))
|
|
16
|
-
throw new Error(`RPC method '${name}' already registered.`);
|
|
17
15
|
this.#methods.set(
|
|
18
16
|
name,
|
|
19
17
|
Object.freeze({
|
|
@@ -26,16 +24,57 @@ export default class RpcRegistry {
|
|
|
26
24
|
);
|
|
27
25
|
}
|
|
28
26
|
|
|
27
|
+
#toolFallback = null;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Set a fallback that auto-dispatches any registered tool via RPC.
|
|
31
|
+
* Checked at request time — tools registered after this call still work.
|
|
32
|
+
*/
|
|
33
|
+
setToolFallback(hooks, buildRunContext, dispatchTool) {
|
|
34
|
+
this.#toolFallback = { hooks, buildRunContext, dispatchTool };
|
|
35
|
+
}
|
|
36
|
+
|
|
29
37
|
registerNotification(name, description = "") {
|
|
30
38
|
this.#notifications.set(name, Object.freeze({ description }));
|
|
31
39
|
}
|
|
32
40
|
|
|
33
41
|
get(name) {
|
|
34
|
-
|
|
42
|
+
const method = this.#methods.get(name);
|
|
43
|
+
if (method) return method;
|
|
44
|
+
return this.#resolveToolFallback(name);
|
|
35
45
|
}
|
|
36
46
|
|
|
37
47
|
has(name) {
|
|
38
|
-
return this.#methods.has(name);
|
|
48
|
+
return this.#methods.has(name) || !!this.#resolveToolFallback(name);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
#resolveToolFallback(name) {
|
|
52
|
+
if (!this.#toolFallback) return undefined;
|
|
53
|
+
const { hooks, buildRunContext, dispatchTool } = this.#toolFallback;
|
|
54
|
+
if (!hooks.tools.has(name)) return undefined;
|
|
55
|
+
return Object.freeze({
|
|
56
|
+
handler: async (params, ctx) => {
|
|
57
|
+
if (!params.path) throw new Error("path is required");
|
|
58
|
+
if (!params.run) throw new Error("run is required");
|
|
59
|
+
const { rummy } = await buildRunContext(hooks, ctx, params.run);
|
|
60
|
+
await dispatchTool(hooks, rummy, name, params.path, params.body || "", {
|
|
61
|
+
path: params.path,
|
|
62
|
+
to: params.to,
|
|
63
|
+
...params.attributes,
|
|
64
|
+
});
|
|
65
|
+
return { status: "ok" };
|
|
66
|
+
},
|
|
67
|
+
description: `Dispatch ${name} tool.`,
|
|
68
|
+
params: {
|
|
69
|
+
run: "string — run alias",
|
|
70
|
+
path: "string — entry path",
|
|
71
|
+
body: "string? — entry content",
|
|
72
|
+
to: "string? — destination path",
|
|
73
|
+
attributes: "object? — JSON attributes",
|
|
74
|
+
},
|
|
75
|
+
requiresInit: true,
|
|
76
|
+
longRunning: false,
|
|
77
|
+
});
|
|
39
78
|
}
|
|
40
79
|
|
|
41
80
|
discover() {
|
|
@@ -43,6 +82,15 @@ export default class RpcRegistry {
|
|
|
43
82
|
for (const [name, def] of this.#methods) {
|
|
44
83
|
methods[name] = { description: def.description, params: def.params };
|
|
45
84
|
}
|
|
85
|
+
// Include auto-dispatched tools not explicitly registered
|
|
86
|
+
if (this.#toolFallback) {
|
|
87
|
+
for (const name of this.#toolFallback.hooks.tools.names) {
|
|
88
|
+
if (methods[name]) continue;
|
|
89
|
+
const def = this.#resolveToolFallback(name);
|
|
90
|
+
if (def)
|
|
91
|
+
methods[name] = { description: def.description, params: def.params };
|
|
92
|
+
}
|
|
93
|
+
}
|
|
46
94
|
const notifications = {};
|
|
47
95
|
for (const [name, def] of this.#notifications) {
|
|
48
96
|
notifications[name] = { description: def.description };
|
|
@@ -15,8 +15,8 @@ visible AS (
|
|
|
15
15
|
, ke.attributes
|
|
16
16
|
, ke.tokens AS tokens_full
|
|
17
17
|
, CASE
|
|
18
|
-
--
|
|
19
|
-
WHEN ke.fidelity = '
|
|
18
|
+
-- Archived entries not in context
|
|
19
|
+
WHEN ke.fidelity = 'archive' THEN NULL
|
|
20
20
|
-- 202 Accepted (proposed) hidden until resolved
|
|
21
21
|
WHEN ke.status = 202 THEN NULL
|
|
22
22
|
-- Audit schemes (model_visible = 0) hidden
|
|
@@ -42,19 +42,18 @@ projected AS (
|
|
|
42
42
|
WHEN visible_fidelity IN ('full', 'summary') THEN body
|
|
43
43
|
ELSE ''
|
|
44
44
|
END AS body
|
|
45
|
+
-- Four roles: data, logging, unknown, prompt.
|
|
46
|
+
-- These are structural — see PluginContext.CATEGORIES.
|
|
47
|
+
-- 'tool' is internal (model_visible=0 in practice).
|
|
48
|
+
-- Default is 'logging' — plugins opt into 'data' explicitly.
|
|
45
49
|
, CASE
|
|
46
|
-
WHEN scheme IS NULL
|
|
47
|
-
WHEN scheme
|
|
48
|
-
WHEN scheme IN ('
|
|
49
|
-
WHEN scheme IN ('http', 'https') THEN 'file_index'
|
|
50
|
-
WHEN scheme IN ('known', 'skill') AND visible_fidelity = 'full' THEN 'known'
|
|
51
|
-
WHEN scheme IN ('known', 'skill') THEN 'known_index'
|
|
50
|
+
WHEN scheme IS NULL THEN 'data'
|
|
51
|
+
WHEN scheme IN ('http', 'https') THEN 'data'
|
|
52
|
+
WHEN scheme IN ('known', 'skill') THEN 'data'
|
|
52
53
|
WHEN scheme = 'unknown' THEN 'unknown'
|
|
53
|
-
WHEN scheme
|
|
54
|
-
WHEN scheme = 'summarize' THEN 'structural'
|
|
55
|
-
WHEN scheme = 'update' THEN 'structural'
|
|
54
|
+
WHEN scheme = 'prompt' THEN 'prompt'
|
|
56
55
|
WHEN scheme = 'tool' THEN 'tool'
|
|
57
|
-
ELSE '
|
|
56
|
+
ELSE 'logging'
|
|
58
57
|
END AS category
|
|
59
58
|
FROM visible
|
|
60
59
|
WHERE visible_fidelity IS NOT NULL
|
|
@@ -74,15 +73,11 @@ SELECT
|
|
|
74
73
|
ORDER BY
|
|
75
74
|
CASE category
|
|
76
75
|
WHEN 'tool' THEN 1
|
|
77
|
-
WHEN '
|
|
78
|
-
WHEN '
|
|
79
|
-
WHEN '
|
|
80
|
-
WHEN '
|
|
81
|
-
|
|
82
|
-
WHEN 'structural' THEN 4
|
|
83
|
-
WHEN 'unknown' THEN 5
|
|
84
|
-
WHEN 'prompt' THEN 6
|
|
85
|
-
ELSE 6
|
|
76
|
+
WHEN 'data' THEN 2
|
|
77
|
+
WHEN 'logging' THEN 3
|
|
78
|
+
WHEN 'unknown' THEN 4
|
|
79
|
+
WHEN 'prompt' THEN 5
|
|
80
|
+
ELSE 5
|
|
86
81
|
END
|
|
87
82
|
, CASE scheme WHEN 'skill' THEN 0 ELSE 1 END
|
|
88
83
|
, CASE fidelity
|
package/src/plugins/cp/docs.md
DELETED
package/src/plugins/env/docs.md
DELETED
package/src/plugins/get/docs.md
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
## <get>[path/to/file]</get> - Load a file or entry into context
|
|
2
|
-
Example: <get>docs/example.txt</get>
|
|
3
|
-
Example: <get>known://auth_flow</get>
|
|
4
|
-
Example: <get path="src/**/*.js" preview/> (list matching files without loading)
|
|
5
|
-
Example: <get path="src/*.js" body="TODO" preview/> (find files containing TODO)
|
|
6
|
-
* Paths accept globs: `src/**/*.js`, `known://api_*`
|
|
7
|
-
* Adding `preview` shows matches without loading into context
|
|
8
|
-
* Use `body` attribute to filter by content
|
|
9
|
-
* Use "known://" paths to recall stored information
|
|
10
|
-
* When irrelevant or resolved, use <store/> to remove from context
|
package/src/plugins/mv/docs.md
DELETED
package/src/plugins/rm/docs.md
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
## <rm path="[path/to/file]"/> - Remove a file or entry
|
|
2
|
-
Example: <rm path="src/config.js"/>
|
|
3
|
-
Example: <rm path="known://donald-rumsfeld-was-born-in-1932"/>
|
|
4
|
-
Example: <rm path="known://temp_*" preview/> (preview before deleting)
|
|
5
|
-
* <rm/> removes the file or entry from context and deletes it PERMANENTLY
|
|
6
|
-
* Paths accept globs — use `preview` to check matches before deleting
|
package/src/plugins/set/docs.md
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
## <set path="[path/to/file]">[edit]</set> - Edit a file or entry
|
|
2
|
-
Example: <set path="src/config.js">s/base_url = http:\/\/localhost/base_url = http:\/\/0.0.0.0/g s/port = 3000/port = 8080/g</set>
|
|
3
|
-
* All editing syntaxes supported: s/old/new/, {"search":"old","replace":"new"}, literal SEARCH/REPLACE blocks
|
|
4
|
-
* Chain multiple replacements: `s/old/new/ s/foo/bar/`
|
|
5
|
-
* Regex patterns use /slashes/: `s/console\.log.*/\/\/ removed/g`
|
|
6
|
-
* Do not use <sh/> or <env/> to read, create, update, or delete files or entries
|
package/src/plugins/sh/docs.md
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# skills
|
|
2
|
-
|
|
3
|
-
Manages skills and personas via RPC methods. Skills are stackable per-run entries; personas are exclusive per-run configuration.
|
|
4
|
-
|
|
5
|
-
## Registration
|
|
6
|
-
|
|
7
|
-
- **No tool handler** — registers RPC methods on `hooks.rpc.registry`.
|
|
8
|
-
|
|
9
|
-
## RPC Methods
|
|
10
|
-
|
|
11
|
-
### Skills
|
|
12
|
-
- `skill/add` — Load a skill from `config/skills/{name}.md` into the run as a `skill://` entry at full state.
|
|
13
|
-
- `skill/remove` — Remove a skill entry from a run.
|
|
14
|
-
- `getSkills` — List active skills on a run.
|
|
15
|
-
- `listSkills` — List available skill files from disk.
|
|
16
|
-
|
|
17
|
-
### Personas
|
|
18
|
-
- `persona/set` — Set persona on a run. Load from `config/personas/{name}.md` by name, pass raw text, or clear by omitting both.
|
|
19
|
-
- `listPersonas` — List available persona files from disk.
|
|
20
|
-
|
|
21
|
-
## Behavior
|
|
22
|
-
|
|
23
|
-
- Skills stack: multiple skills can be active on a run simultaneously as separate `skill://` entries.
|
|
24
|
-
- Personas are exclusive: setting a persona replaces the previous one (stored as a run column, not an entry).
|
|
25
|
-
- File paths resolve from `RUMMY_HOME` environment variable.
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# store
|
|
2
|
-
|
|
3
|
-
Demotes entries from active context to stored (background) state.
|
|
4
|
-
|
|
5
|
-
## Registration
|
|
6
|
-
|
|
7
|
-
- **Tool**: `store`
|
|
8
|
-
- **Modes**: ask, act
|
|
9
|
-
- **Category**: ask
|
|
10
|
-
- **Handler**: Matches entries by pattern, demotes them via `demoteByPattern`, and records the result.
|
|
11
|
-
|
|
12
|
-
## Projection
|
|
13
|
-
|
|
14
|
-
Shows `store {path}`.
|
|
15
|
-
|
|
16
|
-
## Behavior
|
|
17
|
-
|
|
18
|
-
- Pattern queries (globs or body filters) produce a summary of matched paths.
|
|
19
|
-
- Exact path queries report "{path} stored" or "{path} not found".
|
|
20
|
-
- Stored entries remain in the database but are excluded from model context.
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
## <store path="[path/to/file]"/> - Store a file or entry
|
|
2
|
-
Example: <store path="src/config.js"/>
|
|
3
|
-
Example: <store path="src/**/*.test.js"/> (store all test files at once)
|
|
4
|
-
* <store/> removes the file or entry from context, but does not delete it
|
|
5
|
-
* A stored file or entry can be restored with <get/>
|
|
6
|
-
* Paths accept globs for bulk operations
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
|
-
import { storePatternResult } from "../helpers.js";
|
|
3
|
-
|
|
4
|
-
export default class Store {
|
|
5
|
-
#core;
|
|
6
|
-
|
|
7
|
-
constructor(core) {
|
|
8
|
-
this.#core = core;
|
|
9
|
-
core.registerScheme();
|
|
10
|
-
core.on("handler", this.handler.bind(this));
|
|
11
|
-
core.on("full", this.full.bind(this));
|
|
12
|
-
core.on("summary", this.summary.bind(this));
|
|
13
|
-
const docs = readFileSync(new URL("./docs.md", import.meta.url), "utf8");
|
|
14
|
-
core.filter("instructions.toolDocs", async (content) =>
|
|
15
|
-
content ? `${content}\n\n${docs}` : docs,
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async handler(entry, rummy) {
|
|
20
|
-
const { entries: store, sequence: turn, runId, loopId } = rummy;
|
|
21
|
-
const target = entry.attributes.path;
|
|
22
|
-
if (!target) {
|
|
23
|
-
await store.upsert(runId, turn, entry.resultPath, "", 400, {
|
|
24
|
-
attributes: { error: "path is required" },
|
|
25
|
-
loopId,
|
|
26
|
-
});
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const bodyFilter = entry.attributes.body || null;
|
|
30
|
-
const isPattern = bodyFilter || target.includes("*");
|
|
31
|
-
const matches = await store.getEntriesByPattern(runId, target, bodyFilter);
|
|
32
|
-
await store.demoteByPattern(runId, target, bodyFilter);
|
|
33
|
-
|
|
34
|
-
if (isPattern) {
|
|
35
|
-
await storePatternResult(
|
|
36
|
-
store,
|
|
37
|
-
runId,
|
|
38
|
-
turn,
|
|
39
|
-
"store",
|
|
40
|
-
target,
|
|
41
|
-
bodyFilter,
|
|
42
|
-
matches,
|
|
43
|
-
{ loopId },
|
|
44
|
-
);
|
|
45
|
-
} else {
|
|
46
|
-
const paths = matches.map((m) => m.path).join(", ");
|
|
47
|
-
const body =
|
|
48
|
-
matches.length > 0 ? `${paths} stored` : `${target} not found`;
|
|
49
|
-
await store.upsert(runId, turn, entry.resultPath, body, 200, {
|
|
50
|
-
fidelity: "stored",
|
|
51
|
-
loopId,
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
full(entry) {
|
|
57
|
-
return `# store ${entry.attributes.path || entry.path}`;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
summary(entry) {
|
|
61
|
-
return this.full(entry);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
## <unknown>[what you need to learn]</unknown> - Track open questions
|
|
2
|
-
Example: <unknown>contents of answer.txt</unknown>
|
|
3
|
-
Example: <unknown>which database adapter is configured</unknown>
|
|
4
|
-
* Use get, env, or ask_user to investigate unknowns
|
|
5
|
-
* When irrelevant or resolved, use <rm/> to remove from context.
|