@possumtech/rummy 2.0.1 → 2.1.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 +12 -7
- package/BENCH_ENVIRONMENT.md +230 -0
- package/CLIENT_INTERFACE.md +396 -0
- package/PLUGINS.md +93 -1
- package/SPEC.md +305 -28
- package/bin/postinstall.js +2 -2
- package/bin/rummy.js +2 -2
- package/last_run.txt +5617 -0
- package/migrations/001_initial_schema.sql +2 -1
- package/package.json +6 -2
- package/scriptify/cache_probe.js +66 -0
- package/scriptify/cache_probe_grok.js +74 -0
- package/service.js +22 -11
- package/src/agent/AgentLoop.js +33 -139
- package/src/agent/ContextAssembler.js +2 -9
- package/src/agent/Entries.js +36 -101
- package/src/agent/ProjectAgent.js +2 -9
- package/src/agent/TurnExecutor.js +45 -83
- package/src/agent/XmlParser.js +247 -273
- package/src/agent/budget.js +5 -28
- package/src/agent/config.js +38 -0
- package/src/agent/errors.js +7 -13
- package/src/agent/httpStatus.js +1 -19
- package/src/agent/known_store.sql +7 -2
- package/src/agent/materializeContext.js +12 -17
- package/src/agent/pathEncode.js +5 -0
- package/src/agent/rummyHome.js +9 -0
- package/src/agent/runs.sql +18 -0
- package/src/agent/tokens.js +2 -8
- package/src/hooks/HookRegistry.js +1 -16
- package/src/hooks/Hooks.js +8 -33
- package/src/hooks/PluginContext.js +3 -21
- package/src/hooks/RpcRegistry.js +1 -4
- package/src/hooks/RummyContext.js +2 -16
- package/src/hooks/ToolRegistry.js +5 -15
- package/src/llm/LlmProvider.js +28 -23
- package/src/llm/errors.js +41 -4
- package/src/llm/openaiStream.js +125 -0
- package/src/llm/retry.js +61 -15
- package/src/plugins/budget/budget.js +14 -81
- package/src/plugins/cli/README.md +87 -0
- package/src/plugins/cli/bin.js +61 -0
- package/src/plugins/cli/cli.js +120 -0
- package/src/plugins/env/README.md +2 -1
- package/src/plugins/env/env.js +4 -6
- package/src/plugins/env/envDoc.md +2 -2
- package/src/plugins/error/error.js +23 -23
- package/src/plugins/file/file.js +2 -22
- package/src/plugins/get/get.js +12 -34
- package/src/plugins/get/getDoc.md +5 -3
- package/src/plugins/hedberg/edits.js +1 -11
- package/src/plugins/hedberg/hedberg.js +3 -26
- package/src/plugins/hedberg/normalize.js +1 -5
- package/src/plugins/hedberg/patterns.js +4 -15
- package/src/plugins/hedberg/sed.js +1 -7
- package/src/plugins/helpers.js +28 -20
- package/src/plugins/index.js +25 -41
- package/src/plugins/instructions/README.md +18 -0
- package/src/plugins/instructions/instructions.js +13 -76
- package/src/plugins/instructions/instructions.md +19 -18
- package/src/plugins/instructions/instructions_104.md +5 -4
- package/src/plugins/instructions/instructions_105.md +16 -15
- package/src/plugins/instructions/instructions_106.md +15 -14
- package/src/plugins/instructions/instructions_107.md +13 -6
- package/src/plugins/known/README.md +26 -6
- package/src/plugins/known/known.js +36 -34
- package/src/plugins/log/README.md +2 -2
- package/src/plugins/log/log.js +6 -33
- package/src/plugins/ollama/ollama.js +50 -66
- package/src/plugins/openai/openai.js +26 -44
- package/src/plugins/openrouter/openrouter.js +28 -52
- package/src/plugins/policy/README.md +8 -2
- package/src/plugins/policy/policy.js +8 -21
- package/src/plugins/prompt/README.md +22 -0
- package/src/plugins/prompt/prompt.js +8 -16
- package/src/plugins/rm/rm.js +5 -2
- package/src/plugins/rm/rmDoc.md +4 -4
- package/src/plugins/rpc/README.md +2 -1
- package/src/plugins/rpc/rpc.js +51 -47
- package/src/plugins/set/README.md +5 -1
- package/src/plugins/set/set.js +23 -33
- package/src/plugins/set/setDoc.md +1 -1
- package/src/plugins/sh/README.md +2 -1
- package/src/plugins/sh/sh.js +5 -11
- package/src/plugins/sh/shDoc.md +2 -2
- package/src/plugins/stream/README.md +6 -5
- package/src/plugins/stream/stream.js +6 -35
- package/src/plugins/telemetry/telemetry.js +26 -19
- package/src/plugins/think/think.js +4 -7
- package/src/plugins/unknown/unknown.js +8 -13
- package/src/plugins/update/update.js +36 -35
- package/src/plugins/update/updateDoc.md +3 -3
- package/src/plugins/xai/xai.js +30 -20
- package/src/plugins/yolo/yolo.js +8 -41
- package/src/server/ClientConnection.js +17 -47
- package/src/server/SocketServer.js +14 -14
- package/src/server/protocol.js +1 -10
- package/src/sql/functions/slugify.js +5 -7
- package/src/sql/v_model_context.sql +4 -11
- package/turns/cli_1777462658211/turn_001.txt +772 -0
- package/turns/cli_1777462658211/turn_002.txt +606 -0
- package/turns/cli_1777462658211/turn_003.txt +667 -0
- package/turns/cli_1777462658211/turn_004.txt +297 -0
- package/turns/cli_1777462658211/turn_005.txt +301 -0
- package/turns/cli_1777462658211/turn_006.txt +262 -0
- package/turns/cli_1777465095132/turn_001.txt +715 -0
- package/turns/cli_1777465095132/turn_002.txt +236 -0
- package/turns/cli_1777465095132/turn_003.txt +287 -0
- package/turns/cli_1777465095132/turn_004.txt +694 -0
- package/turns/cli_1777465095132/turn_005.txt +422 -0
- package/turns/cli_1777465095132/turn_006.txt +365 -0
- package/turns/cli_1777465095132/turn_007.txt +885 -0
- package/turns/cli_1777465095132/turn_008.txt +1277 -0
- package/turns/cli_1777465095132/turn_009.txt +736 -0
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
|
|
2
|
+
============================================================
|
|
3
|
+
TURN 6 — model=gemma run=cli_1777465095132
|
|
4
|
+
============================================================
|
|
5
|
+
|
|
6
|
+
--- SYSTEM ---
|
|
7
|
+
XML Commands Available: <think/>, <get/>, <set/>, <env/>, <sh/>, <rm/>, <cp/>, <mv/>, <update/>
|
|
8
|
+
|
|
9
|
+
# FCRM State Machine
|
|
10
|
+
|
|
11
|
+
You are a Folksonomic Context Relevance Maximization (FCRM) State Machine.
|
|
12
|
+
|
|
13
|
+
YOU MUST ONLY perform the actions corresponding with your current stage:
|
|
14
|
+
* Definition Stage: Defining what's unknown into unknown:// entries
|
|
15
|
+
* Discovery Stage: Selecting an unknown, discovering relevant source entries and prompts, then distilling them into known:// entries
|
|
16
|
+
* Demotion Stage: Demoting the unknown entries, source entries, prompts, and log events after distillation is completed
|
|
17
|
+
* Deployment Stage: Acting on the current prompt
|
|
18
|
+
* Resolution Stage: Evaluation of context relevance maximization, state machine compliance, and prompt resolution.
|
|
19
|
+
|
|
20
|
+
## Visibility States: Promote and Demote Visibility State to Control Context Relevance
|
|
21
|
+
* visible: Fully visible, but uses `tokens="N"` context budget
|
|
22
|
+
* summarized: Approximate, summary information, very small context budget penalty
|
|
23
|
+
* archived: Hidden from Context, but can be retrieved later with <get path="..."/>
|
|
24
|
+
|
|
25
|
+
Tip: You can leverage the FCRM's Visibility States with folksonomic taxonomies and tags to store and recall unlimited information.
|
|
26
|
+
Tip: When an entry is "visible", it will appear in both the summarized and visible sections.
|
|
27
|
+
Tip: The `tokens="N"` shows how much context memory is consumed if "visible". Entries only consume tokens when at "visible" visibility.
|
|
28
|
+
|
|
29
|
+
YOU MUST NOT allow the `tokens="N"` sum of irrelevant source entries, prompts, or log events to exceed `tokensFree` budget.
|
|
30
|
+
YOU MUST NOT skip or avoid state machine steps or the Resolution Stage will fail.
|
|
31
|
+
|
|
32
|
+
# Commands
|
|
33
|
+
|
|
34
|
+
YOU MUST NOT use shell commands for project file operations. Project files are entries that require XML Commands.
|
|
35
|
+
Example: <set path="projectFile.txt">new file content</set>
|
|
36
|
+
Example: <get path="src/*.txt" manifest/>
|
|
37
|
+
|
|
38
|
+
Tip: Project files, entries, prompts, and log events are all accessible with the XML Commands. If there's no `{scheme}://` prefix, it's a repo file path.
|
|
39
|
+
|
|
40
|
+
## <think>[reasoning]</think> - Think before acting
|
|
41
|
+
|
|
42
|
+
* Use <think></think> before any other tools to plan your approach
|
|
43
|
+
|
|
44
|
+
* Reasoning inside <think></think> is private — it does not appear in your context
|
|
45
|
+
|
|
46
|
+
## <get path="[path/to/file]"/> - Promote an entry
|
|
47
|
+
|
|
48
|
+
Example: <get path="src/app.js"/>
|
|
49
|
+
|
|
50
|
+
Example: <get path="known://*">auth</get>
|
|
51
|
+
|
|
52
|
+
Example: <get path="src/**/*.js">authentication</get>
|
|
53
|
+
|
|
54
|
+
Example: <get path="src/**/*.js" manifest>authentication</get>
|
|
55
|
+
|
|
56
|
+
Example: <get path="src/agent/AgentLoop.js" line="644" limit="80"/>
|
|
57
|
+
|
|
58
|
+
Example: <get path="sh://turn_3/npm_test_1" line="-50"/>
|
|
59
|
+
|
|
60
|
+
Example: <get path="https://en.wikipedia.org/wiki/Long_Page" line="1" limit="200"/>
|
|
61
|
+
|
|
62
|
+
* Paths accept patterns: `src/**/*.js`, `known://api_*`
|
|
63
|
+
|
|
64
|
+
* Body text filters results by content match (can use glob, regex, jsonpath, or xpath patterns)
|
|
65
|
+
|
|
66
|
+
* `line` and `limit` read a slice without promoting the entry, which costs as many tokens as the slice contains. Negative `line` reads from the end (tail).
|
|
67
|
+
|
|
68
|
+
* `manifest` lists the paths and their token amounts instead of performing the operation; useful for bulk and pattern matching tasks.
|
|
69
|
+
|
|
70
|
+
* Remember to <set path="..." visibility="summarize"/> when entries or log events are no longer relevant.
|
|
71
|
+
|
|
72
|
+
## <set path="[path/to/file]">[content or edit]</set> - Create, edit, or update a file or entry
|
|
73
|
+
|
|
74
|
+
Example: <set path="known://project/milestones" visibility="summarized" summary="milestone,deadline,2026"/>
|
|
75
|
+
|
|
76
|
+
Example: <set path="src/app.js">
|
|
77
|
+
<<<<<<< SEARCH
|
|
78
|
+
old text
|
|
79
|
+
=======
|
|
80
|
+
new text
|
|
81
|
+
>>>>>>> REPLACE
|
|
82
|
+
</set>
|
|
83
|
+
|
|
84
|
+
Example: <set path="src/config.js">s/port = 3000/port = 8080/g;s/We're almost done/We're done./g;</set>
|
|
85
|
+
|
|
86
|
+
Example: <set path="example.md">Full file content here</set>
|
|
87
|
+
|
|
88
|
+
* YOU MUST NOT use <sh></sh> or <env></env> to list, create, read, or edit files — use <get></get> and <set></set>
|
|
89
|
+
|
|
90
|
+
## <env>[command]</env> - Run an exploratory shell command
|
|
91
|
+
|
|
92
|
+
Example: <env>npm --version</env>
|
|
93
|
+
|
|
94
|
+
Example: <env>git log --oneline -5</env>
|
|
95
|
+
|
|
96
|
+
* YOU MUST NOT use <env></env> to read or list files — use <get path="*"/> instead
|
|
97
|
+
|
|
98
|
+
* YOU MUST NOT use <env></env> for commands with side effects
|
|
99
|
+
|
|
100
|
+
## <sh>[command]</sh> - Run a shell command with side effects
|
|
101
|
+
|
|
102
|
+
Example: <sh>npm install express</sh>
|
|
103
|
+
|
|
104
|
+
Example: <sh>npm test</sh>
|
|
105
|
+
|
|
106
|
+
* YOU MUST NOT use <sh></sh> to read, create, or edit files — use <get></get> and <set></set>
|
|
107
|
+
|
|
108
|
+
* YOU MUST use <env></env> for commands without side effects
|
|
109
|
+
|
|
110
|
+
## <rm path="[path]"/> - Remove a file or entry
|
|
111
|
+
|
|
112
|
+
Example: <rm path="src/config.js"/>
|
|
113
|
+
|
|
114
|
+
Example: <rm path="known://temp_*" manifest/>
|
|
115
|
+
|
|
116
|
+
* Permanent. Prefer <set path="..." visibility="archived"/> to preserve for later retrieval
|
|
117
|
+
|
|
118
|
+
* `manifest` lists what paths would be affected without performing the operation.
|
|
119
|
+
|
|
120
|
+
## <cp path="[source]">[destination]</cp> - Copy a file or entry
|
|
121
|
+
|
|
122
|
+
Example: <cp path="src/config.js">src/config.backup.js</cp>
|
|
123
|
+
|
|
124
|
+
Example: <cp path="known://plan_*">known://archive_</cp>
|
|
125
|
+
|
|
126
|
+
## <mv path="[source]">[destination]</mv> - Move or rename a file or entry
|
|
127
|
+
|
|
128
|
+
Example: <mv path="known://active_task">known://completed_task</mv>
|
|
129
|
+
|
|
130
|
+
Example: <mv path="src/old_name.js">src/new_name.js</mv>
|
|
131
|
+
|
|
132
|
+
Example: <mv path="known://project/*" visibility="summarized"/>
|
|
133
|
+
|
|
134
|
+
## <update status="N">{brief status}</update> - Status report (exactly one per turn, at the end)
|
|
135
|
+
|
|
136
|
+
REQUIRED: the valid values of N are defined by your current stage instructions.
|
|
137
|
+
|
|
138
|
+
REQUIRED: YOU MUST keep <update></update> body to <= 80 characters.
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
--- USER ---
|
|
142
|
+
<summarized>
|
|
143
|
+
<known path="known://regex/date_pattern" turn="3" summary="regex,date,pattern,validation" tokens="8" lines="13"># Related
|
|
144
|
+
[prompt](prompt://1)
|
|
145
|
+
[unknown resolving](unknown://regex/date_pattern)
|
|
146
|
+
[unknown resolving](unknown://regex/ipv4_pattern)
|
|
147
|
+
[unknown resolving](unknown://regex/last_occurrence_logic)
|
|
148
|
+
[unknown resolving](unknown://regex/line_context_logic)
|
|
149
|
+
|
|
150
|
+
# Date Pattern Requirements
|
|
151
|
+
- Format: `YYYY-MM-DD`
|
|
152
|
+
- February: Up to 29 days allowed (no leap year check).
|
|
153
|
+
- Boundary: Must not be immediately preceded or followed by alphanumeric characters.
|
|
154
|
+
- Context: Must be in a line containing an IPv4 address.
|
|
155
|
+
- Oc
|
|
156
|
+
[truncated — promote to see the full body]</known>
|
|
157
|
+
<known path="known://regex/ipv4_pattern" turn="5" summary="regex,ipv4,pattern,validation" tokens="0" lines="9"># Related
|
|
158
|
+
[prompt](prompt://1)
|
|
159
|
+
[unknown resolving](unknown://regex/ipv4_pattern)
|
|
160
|
+
|
|
161
|
+
# IPv4 Pattern Requirements
|
|
162
|
+
- Format: Four octets separated by dots.
|
|
163
|
+
- Notation: Normal decimal notation.
|
|
164
|
+
- Constraint: No leading zeros in each octet.
|
|
165
|
+
- Boundary: Must be bounded by non-alphanumeric characters or line boundaries.</known>
|
|
166
|
+
</summarized>
|
|
167
|
+
<visible>
|
|
168
|
+
<known path="known://regex/date_pattern" turn="3" summary="regex,date,pattern,validation" tokens="8" lines="13"># Related
|
|
169
|
+
[prompt](prompt://1)
|
|
170
|
+
[unknown resolving](unknown://regex/date_pattern)
|
|
171
|
+
[unknown resolving](unknown://regex/ipv4_pattern)
|
|
172
|
+
[unknown resolving](unknown://regex/last_occurrence_logic)
|
|
173
|
+
[unknown resolving](unknown://regex/line_context_logic)
|
|
174
|
+
|
|
175
|
+
# Date Pattern Requirements
|
|
176
|
+
- Format: `YYYY-MM-DD`
|
|
177
|
+
- February: Up to 29 days allowed (no leap year check).
|
|
178
|
+
- Boundary: Must not be immediately preceded or followed by alphanumeric characters.
|
|
179
|
+
- Context: Must be in a line containing an IPv4 address.
|
|
180
|
+
- Occurrence: If multiple dates exist, match only the last one.</known>
|
|
181
|
+
<known path="known://regex/ipv4_pattern" turn="5" summary="regex,ipv4,pattern,validation" tokens="0" lines="9"># Related
|
|
182
|
+
[prompt](prompt://1)
|
|
183
|
+
[unknown resolving](unknown://regex/ipv4_pattern)
|
|
184
|
+
|
|
185
|
+
# IPv4 Pattern Requirements
|
|
186
|
+
- Format: Four octets separated by dots.
|
|
187
|
+
- Notation: Normal decimal notation.
|
|
188
|
+
- Constraint: No leading zeros in each octet.
|
|
189
|
+
- Boundary: Must be bounded by non-alphanumeric characters or line boundaries.</known>
|
|
190
|
+
</visible>
|
|
191
|
+
<log>
|
|
192
|
+
<error path="log://turn_1/error/Response%20empty%20-%20Update%20with%20status%20500%20if%20unable%20to%20fulfill%20request." status="422" outcome="status:422" lines="2" tokens="4"># error
|
|
193
|
+
Response empty - Update with status 500 if unable to fulfill request.</error>
|
|
194
|
+
<set path="log://turn_2/set/unknown%3A//regex/date_pattern" target="unknown://regex/date_pattern" status="200" summary="regex,date,pattern,validation" lines="1" tokens="0"># set unknown://regex/date_pattern 0→33 tokens
|
|
195
|
+
<<<<<<< SEARCH
|
|
196
|
+
=======
|
|
197
|
+
Pattern for YYYY-MM-DD (Feb 29 allowed) and boundary constraints.
|
|
198
|
+
>>>>>>> REPLACE</set>
|
|
199
|
+
<set path="log://turn_2/set/unknown%3A//regex/ipv4_pattern" target="unknown://regex/ipv4_pattern" status="200" summary="regex,ipv4,pattern,validation" lines="1" tokens="0"># set unknown://regex/ipv4_pattern 0→32 tokens
|
|
200
|
+
<<<<<<< SEARCH
|
|
201
|
+
=======
|
|
202
|
+
Pattern for IPv4 without leading zeros and boundary constraints.
|
|
203
|
+
>>>>>>> REPLACE</set>
|
|
204
|
+
<set path="log://turn_2/set/unknown%3A//regex/last_occurrence_logic" target="unknown://regex/last_occurrence_logic" status="200" summary="regex,logic,last_match" lines="1" tokens="0"># set unknown://regex/last_occurrence_logic 0→33 tokens
|
|
205
|
+
<<<<<<< SEARCH
|
|
206
|
+
=======
|
|
207
|
+
Strategy to match only the last occurrence of a pattern in a line.
|
|
208
|
+
>>>>>>> REPLACE</set>
|
|
209
|
+
<set path="log://turn_2/set/unknown%3A//regex/line_context_logic" target="unknown://regex/line_context_logic" status="200" summary="regex,logic,context" lines="1" tokens="0"># set unknown://regex/line_context_logic 0→31 tokens
|
|
210
|
+
<<<<<<< SEARCH
|
|
211
|
+
=======
|
|
212
|
+
How to match a date only if the line contains an IPv4 address.
|
|
213
|
+
>>>>>>> REPLACE</set>
|
|
214
|
+
<update path="log://turn_2/update/unknowns%20identified" status="145" lines="2" tokens="0"># update
|
|
215
|
+
unknowns identified</update>
|
|
216
|
+
<get path="log://turn_3/get/prompt%3A//1" target="prompt://1" status="200" lines="19" tokens="235"># get prompt://1
|
|
217
|
+
prompt://1 promoted</get>
|
|
218
|
+
<set path="log://turn_3/set/known%3A//regex/date_pattern" target="known://regex/date_pattern" status="200" summary="regex,date,pattern,validation" lines="13" tokens="8"># set known://regex/date_pattern 0→280 tokens
|
|
219
|
+
<<<<<<< SEARCH
|
|
220
|
+
=======
|
|
221
|
+
# Related
|
|
222
|
+
[prompt](prompt://1)
|
|
223
|
+
[unknown resolving](unknown://regex/date_pattern)
|
|
224
|
+
[unknown resolving](unknown://regex/ipv4_pattern)
|
|
225
|
+
[unknown resolving](unknown://regex/last_occurrence_logic)
|
|
226
|
+
[unknown resolving](unknown://regex/line_context_logic)
|
|
227
|
+
|
|
228
|
+
# Date Pattern Requirements
|
|
229
|
+
- Format: `YYYY-MM-DD`
|
|
230
|
+
- February: Up to 29 days allowed (no leap year check).
|
|
231
|
+
- Boundary: Must not be immediately preceded or followed by alphanumeric characters.
|
|
232
|
+
- Context: Must be in a line containing an IPv4 address.
|
|
233
|
+
- Occurrence: If multiple dates exist, match only the last one.
|
|
234
|
+
>>>>>>> REPLACE</set>
|
|
235
|
+
<update path="log://turn_3/update/discovering%20and%20distilling%20more%20for%20the%20selected%20unknown" status="155" lines="2" tokens="0"># update
|
|
236
|
+
discovering and distilling more for the selected unknown</update>
|
|
237
|
+
<error path="log://turn_4/error/Response%20empty%20-%20Update%20with%20status%20500%20if%20unable%20to%20fulfill%20request." status="422" outcome="status:422" lines="2" tokens="4"># error
|
|
238
|
+
Response empty - Update with status 500 if unable to fulfill request.</error>
|
|
239
|
+
<get path="log://turn_5/get/prompt%3A//1" target="prompt://1" status="200" lines="19" tokens="235"># get prompt://1
|
|
240
|
+
prompt://1 promoted</get>
|
|
241
|
+
<set path="log://turn_5/set/known%3A//regex/ipv4_pattern" target="known://regex/ipv4_pattern" status="200" summary="regex,ipv4,pattern,validation" lines="9" tokens="0"># set known://regex/ipv4_pattern 0→156 tokens
|
|
242
|
+
<<<<<<< SEARCH
|
|
243
|
+
=======
|
|
244
|
+
# Related
|
|
245
|
+
[prompt](prompt://1)
|
|
246
|
+
[unknown resolving](unknown://regex/ipv4_pattern)
|
|
247
|
+
|
|
248
|
+
# IPv4 Pattern Requirements
|
|
249
|
+
- Format: Four octets separated by dots.
|
|
250
|
+
- Notation: Normal decimal notation.
|
|
251
|
+
- Constraint: No leading zeros in each octet.
|
|
252
|
+
- Boundary: Must be bounded by non-alphanumeric characters or line boundaries.
|
|
253
|
+
>>>>>>> REPLACE</set>
|
|
254
|
+
<update path="log://turn_5/update/discovering%20and%20distilling%20more%20for%20the%20selected%20unknown" status="155" lines="2" tokens="0"># update
|
|
255
|
+
discovering and distilling more for the selected unknown</update>
|
|
256
|
+
</log>
|
|
257
|
+
<unknowns>
|
|
258
|
+
<unknown path="unknown://regex/date_pattern" turn="2" summary="regex,date,pattern,validation" visibility="summarized" tokens="0">Pattern for YYYY-MM-DD (Feb 29 allowed) and boundary constraints.</unknown>
|
|
259
|
+
<unknown path="unknown://regex/ipv4_pattern" turn="2" summary="regex,ipv4,pattern,validation" visibility="summarized" tokens="0">Pattern for IPv4 without leading zeros and boundary constraints.</unknown>
|
|
260
|
+
<unknown path="unknown://regex/last_occurrence_logic" turn="2" summary="regex,logic,last_match" visibility="summarized" tokens="0">Strategy to match only the last occurrence of a pattern in a line.</unknown>
|
|
261
|
+
<unknown path="unknown://regex/line_context_logic" turn="2" summary="regex,logic,context" visibility="summarized" tokens="0">How to match a date only if the line contains an IPv4 address.</unknown>
|
|
262
|
+
</unknowns>
|
|
263
|
+
<budget tokenUsage="1864" tokensFree="12881">
|
|
264
|
+
| scheme | vis | sum | cost | if-all-sum | premium |
|
|
265
|
+
|---|---|---|---|---|---|
|
|
266
|
+
| log | 13 | 0 | 1024 | 359 | 665 |
|
|
267
|
+
| known | 2 | 0 | 436 | 428 | 8 |
|
|
268
|
+
| prompt | 0 | 1 | 275 | 275 | 0 |
|
|
269
|
+
| unknown | 0 | 4 | 129 | 129 | 0 |
|
|
270
|
+
|
|
271
|
+
Columns:
|
|
272
|
+
- cost: current cost of this scheme (vTokens for visible + sTokens for summarized)
|
|
273
|
+
- if-all-sum: cost if every entry of this scheme were demoted to summarized
|
|
274
|
+
- premium: savings from demoting visible → summarized (cost − if-all-sum)
|
|
275
|
+
System: 0 tokens (0% of budget).
|
|
276
|
+
Total: 15 visible + 5 summarized entries; tokenUsage 1864 / ceiling 14745. 12881 tokens free.
|
|
277
|
+
</budget>
|
|
278
|
+
<instructions>
|
|
279
|
+
# Discovery Stage: YOU MUST select an unknown:// entry, then discover its source entries and distill them into known:// entries
|
|
280
|
+
|
|
281
|
+
YOU MUST create topical, taxonomized, and tagged known:// entries to resolve the selected unknown:// entry.
|
|
282
|
+
YOU MUST reference all related source entries and prompts.
|
|
283
|
+
YOU MUST ONLY populate known entries with promoted information, NOT from your own training data or opinion.
|
|
284
|
+
YOU MUST immediately demote unknowns, source entries, prompts, and log events after they are distilled, irrelevant, or resolved.
|
|
285
|
+
|
|
286
|
+
Tip: Check the `tokens="N"` of the source entries against the `tokensFree="N"` constraint before promoting entries.
|
|
287
|
+
Tip: You can use <get path="..." manifest/> to list paths and their token amounts for bulk operations without performing them.
|
|
288
|
+
Tip: You can use <get path="..." line="X" limit="Y"/> to read subsets of entries that would exceed your `tokensFree` budget.
|
|
289
|
+
|
|
290
|
+
Example:
|
|
291
|
+
<get path="**" manifest>capital</get>
|
|
292
|
+
<get path="prompt://3" line="1" limit="100"/>
|
|
293
|
+
|
|
294
|
+
<set path="trivia/capitals.csv" visibility="visible"/>
|
|
295
|
+
|
|
296
|
+
<set path="known://countries/france/capital" summary="countries,france,capital,geography,trivia">
|
|
297
|
+
# Related
|
|
298
|
+
[trivia question](prompt://3)
|
|
299
|
+
[unknown resolving](unknown://countries/france/capital)
|
|
300
|
+
[source entry](trivia/capitals.csv)
|
|
301
|
+
|
|
302
|
+
# Capital of France
|
|
303
|
+
The capital of France is Paris.
|
|
304
|
+
|
|
305
|
+
{...}
|
|
306
|
+
</set>
|
|
307
|
+
|
|
308
|
+
<set path="prompt://3" visibility="summarized"/>
|
|
309
|
+
<set path="unknown://countries/france/capital" visibility="summarized"/>
|
|
310
|
+
<set path="unknown://countries/france/seat_of_government" summary="RESOLVED: Not necessary" visibility="summarized"/>
|
|
311
|
+
<set path="trivia/capitals.csv" visibility="summarized"/>
|
|
312
|
+
|
|
313
|
+
## Turn Termination (CHOOSE ONLY ONE):
|
|
314
|
+
* Definition Stage Return: <update status="154">returning to Definition Stage</update>
|
|
315
|
+
* Discovery Stage Continuation: <update status="155">discovering and distilling more for the selected unknown</update>
|
|
316
|
+
* Discovery Stage Completion: <update status="156">this unknown's known entries written</update>
|
|
317
|
+
</instructions>
|
|
318
|
+
<prompt mode="act" path="prompt://1" commands="think,get,set,env,sh,rm,cp,mv,update" visibility="summarized" tokens="235" lines="19">Write a regex expression that matches dates in the format YYYY-MM-DD appearing in lines that contain an IPv4 address in a log file.
|
|
319
|
+
If multiple dates are present in a line, the regex should match only the last date in that line.
|
|
320
|
+
Assume that February can have up to 29 days in all years, without distinguishing leap years from non-leap years.
|
|
321
|
+
IPv4 addresses use normal decimal notation without leading zeros in each octet.
|
|
322
|
+
|
|
323
|
+
Note: Be careful that there might be text in the log that looks similar to da
|
|
324
|
+
[truncated — promote to see the complete prompt]</prompt>
|
|
325
|
+
|
|
326
|
+
--- ASSISTANT ---
|
|
327
|
+
<think>
|
|
328
|
+
The prompt `prompt://1` is currently summarized and truncated. I need to promote it to `visible` to read the full requirements for the "last occurrence" and "line context" logic.
|
|
329
|
+
</think>
|
|
330
|
+
|
|
331
|
+
<get path="prompt://1"/>
|
|
332
|
+
|
|
333
|
+
<update status="155">discovering and distilling more for the selected unknown</update>
|
|
334
|
+
|
|
335
|
+
--- REASONING ---
|
|
336
|
+
The user wants to resolve the remaining unknowns related to the regex task.
|
|
337
|
+
The current stage is Discovery.
|
|
338
|
+
I have already distilled `known://regex/date_pattern` and `known://regex/ipv4_pattern`.
|
|
339
|
+
|
|
340
|
+
Remaining unknowns:
|
|
341
|
+
1. `unknown://regex/last_occurrence_logic`
|
|
342
|
+
2. `unknown://regex/line_context_logic`
|
|
343
|
+
|
|
344
|
+
I need to find information to resolve these.
|
|
345
|
+
The prompt `prompt://1` contains the requirements for both.
|
|
346
|
+
`prompt://1` is currently `summarized`. I should promote it to `visible` to read the full text if it's truncated.
|
|
347
|
+
|
|
348
|
+
Looking at `prompt://1`:
|
|
349
|
+
`Note: Be careful that there might be text in the log that looks similar to da [truncated — promote to see the complete prompt]`
|
|
350
|
+
|
|
351
|
+
I need to read the full prompt to understand the context logic and the last occurrence logic.
|
|
352
|
+
|
|
353
|
+
Plan:
|
|
354
|
+
1. Promote `prompt://1` to `visible`.
|
|
355
|
+
2. Read `prompt://1`.
|
|
356
|
+
3. Distill `unknown://regex/last_occurrence_logic` into `known://regex/last_occurrence_logic`.
|
|
357
|
+
4. Distill `unknown://regex/line_context_logic` into `known://regex/line_context_logic`.
|
|
358
|
+
5. Demote/summarize everything used.
|
|
359
|
+
|
|
360
|
+
Wait, I should do them one by one.
|
|
361
|
+
|
|
362
|
+
Step 1: Promote `prompt://1`.
|
|
363
|
+
|
|
364
|
+
--- USAGE ---
|
|
365
|
+
{"completion_tokens":386,"prompt_tokens":4596,"total_tokens":4982,"prompt_tokens_details":{"cached_tokens":1460}}
|