@duckmind/dm-windows-x64 0.63.4 → 0.63.6
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/extensions/.dm-extensions.json +64 -4
- package/extensions/dm-context/package.json +1 -1
- package/extensions/dm-context/skills/context-management/SKILL.md +173 -223
- package/extensions/dm-context/skills/context-management/references/development-and-troubleshooting.md +75 -0
- package/extensions/dm-context/skills/context-management/references/interleaved-async-work.md +143 -0
- package/extensions/dm-context/skills/context-management/references/planning-and-execution.md +81 -0
- package/extensions/dm-context/skills/context-management/references/repeated-items-and-batch-work.md +69 -0
- package/extensions/dm-context/skills/context-management/references/retry-branch-and-pivot.md +80 -0
- package/extensions/dm-context/skills/context-management/references/search-research-and-reading.md +103 -0
- package/extensions/dm-context/skills/context-management/references/task-switching-and-cleanup.md +73 -0
- package/extensions/dm-context/src/context.js +3 -2
- package/extensions/dm-context/src/index.js +168 -84
- package/extensions/dm-skills-manager/THIRD_PARTY_NOTICES.md +27 -0
- package/extensions/dm-skills-manager/extensions/skills-manager/components.js +265 -0
- package/extensions/dm-skills-manager/extensions/skills-manager/constants.js +31 -0
- package/extensions/dm-skills-manager/extensions/skills-manager/creation-fallback.js +20 -0
- package/extensions/dm-skills-manager/extensions/skills-manager/creation.js +145 -0
- package/extensions/dm-skills-manager/extensions/skills-manager/dialog.js +738 -0
- package/extensions/dm-skills-manager/extensions/skills-manager/dm-ai-compat.js +15 -0
- package/extensions/dm-skills-manager/extensions/skills-manager/format.js +125 -0
- package/extensions/dm-skills-manager/extensions/skills-manager/glyphs.js +142 -0
- package/extensions/dm-skills-manager/extensions/skills-manager/layout.js +93 -0
- package/extensions/dm-skills-manager/extensions/skills-manager/paths.js +76 -0
- package/extensions/dm-skills-manager/extensions/skills-manager/registry.js +95 -0
- package/extensions/dm-skills-manager/extensions/skills-manager/settings.js +93 -0
- package/extensions/dm-skills-manager/extensions/skills-manager/startup.js +32 -0
- package/extensions/dm-skills-manager/extensions/skills-manager/toggle.js +54 -0
- package/extensions/dm-skills-manager/extensions/skills-manager/types.js +14 -0
- package/extensions/dm-skills-manager/extensions/skills-manager/ui.js +121 -0
- package/extensions/dm-skills-manager/extensions/skills-manager.js +111 -0
- package/extensions/dm-skills-manager/package.json +121 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"status": "ok",
|
|
3
|
-
"prepared_at": "2026-08-
|
|
3
|
+
"prepared_at": "2026-08-31T17:37:37.181676+00:00",
|
|
4
4
|
"managed_entries": [
|
|
5
5
|
{
|
|
6
6
|
"id": "dm-context",
|
|
@@ -41,6 +41,11 @@
|
|
|
41
41
|
"id": "dm-web-access",
|
|
42
42
|
"target_dir": "extensions/dm-web-access",
|
|
43
43
|
"bundle_mode": "source-package-with-runtime-deps"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"id": "dm-skills-manager",
|
|
47
|
+
"target_dir": "extensions/dm-skills-manager",
|
|
48
|
+
"bundle_mode": "source-package-with-runtime-deps"
|
|
44
49
|
}
|
|
45
50
|
],
|
|
46
51
|
"local_entries": [
|
|
@@ -82,8 +87,8 @@
|
|
|
82
87
|
"src/utils.js"
|
|
83
88
|
],
|
|
84
89
|
"file_count": 3,
|
|
85
|
-
"before_bytes":
|
|
86
|
-
"after_bytes":
|
|
90
|
+
"before_bytes": 32134,
|
|
91
|
+
"after_bytes": 25217,
|
|
87
92
|
"runtime_specifier_rewrites": 0,
|
|
88
93
|
"runtime_filename_rewrites": 3,
|
|
89
94
|
"declaration_files_removed": 0
|
|
@@ -713,6 +718,61 @@
|
|
|
713
718
|
"declaration_files_removed": 1
|
|
714
719
|
}
|
|
715
720
|
},
|
|
721
|
+
{
|
|
722
|
+
"id": "dm-skills-manager",
|
|
723
|
+
"staged_dir": "extensions/dm-skills-manager",
|
|
724
|
+
"bundle_mode": "source-package-with-runtime-deps",
|
|
725
|
+
"dependencies_installed": false,
|
|
726
|
+
"dependency_mode": "platform-package-dependency",
|
|
727
|
+
"dependencies_declared": [
|
|
728
|
+
"@duckmind/dm-ai",
|
|
729
|
+
"@duckmind/dm-coding-agent",
|
|
730
|
+
"@duckmind/dm-tui"
|
|
731
|
+
],
|
|
732
|
+
"dependency_patches": [
|
|
733
|
+
"dm.extensions ts->js",
|
|
734
|
+
"drop-devDependencies",
|
|
735
|
+
"drop-peerDependencies",
|
|
736
|
+
"drop-repository",
|
|
737
|
+
"drop-bugs",
|
|
738
|
+
"drop-homepage",
|
|
739
|
+
"drop-scripts",
|
|
740
|
+
"drop-files"
|
|
741
|
+
],
|
|
742
|
+
"stripped_documentation": [
|
|
743
|
+
"README.md",
|
|
744
|
+
"assets/skills-manager.png"
|
|
745
|
+
],
|
|
746
|
+
"javascript_compile": {
|
|
747
|
+
"tool": "bun build --no-bundle",
|
|
748
|
+
"mode": "module-preserving-transpile",
|
|
749
|
+
"files": [
|
|
750
|
+
"extensions/skills-manager/components.js",
|
|
751
|
+
"extensions/skills-manager/constants.js",
|
|
752
|
+
"extensions/skills-manager/creation-fallback.js",
|
|
753
|
+
"extensions/skills-manager/creation.js",
|
|
754
|
+
"extensions/skills-manager/dialog.js",
|
|
755
|
+
"extensions/skills-manager/dm-ai-compat.js",
|
|
756
|
+
"extensions/skills-manager/format.js",
|
|
757
|
+
"extensions/skills-manager/glyphs.js",
|
|
758
|
+
"extensions/skills-manager/layout.js",
|
|
759
|
+
"extensions/skills-manager/paths.js",
|
|
760
|
+
"extensions/skills-manager/registry.js",
|
|
761
|
+
"extensions/skills-manager/settings.js",
|
|
762
|
+
"extensions/skills-manager/startup.js",
|
|
763
|
+
"extensions/skills-manager/toggle.js",
|
|
764
|
+
"extensions/skills-manager/types.js",
|
|
765
|
+
"extensions/skills-manager/ui.js",
|
|
766
|
+
"extensions/skills-manager.js"
|
|
767
|
+
],
|
|
768
|
+
"file_count": 17,
|
|
769
|
+
"before_bytes": 95706,
|
|
770
|
+
"after_bytes": 85484,
|
|
771
|
+
"runtime_specifier_rewrites": 0,
|
|
772
|
+
"runtime_filename_rewrites": 17,
|
|
773
|
+
"declaration_files_removed": 0
|
|
774
|
+
}
|
|
775
|
+
},
|
|
716
776
|
{
|
|
717
777
|
"id": "dm-cua",
|
|
718
778
|
"staged_dir": "extensions/dm-cua",
|
|
@@ -806,7 +866,7 @@
|
|
|
806
866
|
},
|
|
807
867
|
"runtime_loader": {
|
|
808
868
|
"status": "verified",
|
|
809
|
-
"entries":
|
|
869
|
+
"entries": 12,
|
|
810
870
|
"loader": "dm-coding-agent",
|
|
811
871
|
"platform_dependencies": [
|
|
812
872
|
"@mozilla/readability",
|
|
@@ -1,258 +1,208 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: context-management
|
|
3
|
-
description:
|
|
3
|
+
description: "Use this skill for multi-turn, phased, or noisy work: research/reading, debugging, plan-then-execute, retries/pivots, background or asynchronous work, handoffs, user decisions, task switching, repeated items, or repeated progress checks. It keeps the conversation as a clean working set with checkpoints, timeline review, and compaction at continuation boundaries. Always use when resuming after context compaction or when a long phase reaches a decision, handoff, validation, or task-switch boundary. Usually skip simple one-shot tasks."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Context Management
|
|
7
7
|
|
|
8
|
-
**
|
|
8
|
+
Use this skill to keep the active conversation as a useful **working set** for the next step. Keep raw only the context that still needs direct reasoning; carry the rest as compact task state when that is more efficient.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Core rhythm:
|
|
11
11
|
|
|
12
|
-
**
|
|
13
|
-
|
|
12
|
+
- **checkpoint before mess**
|
|
13
|
+
- **review timeline when structure affects the next decision**
|
|
14
|
+
- **compact when a state summary is a better working set than the raw trail**
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
Use only these tools:
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
- `context_checkpoint`
|
|
19
|
+
- `context_timeline`
|
|
20
|
+
- `context_compact`
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
```
|
|
22
|
+
## Working-set model
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
Before choosing a tool, ask:
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
* Check the Graph: Where are you? Are you in a deep branch?
|
|
32
|
-
3. **NAVIGATE & MERGE (`context_checkout`)**:
|
|
33
|
-
* **Squash:** Convert a messy "feature branch" (thinking process) into a single "merge commit" (summary).
|
|
34
|
-
* **Jump:** Move between tasks or retry paths without carrying baggage.
|
|
26
|
+
- What am I trying to do next?
|
|
27
|
+
- What facts, constraints, or artifacts must stay raw for that next action?
|
|
28
|
+
- What important data has a reliable external source I can re-check instead of carrying raw?
|
|
29
|
+
- What history is useful only as a conclusion, pointer, or state update?
|
|
30
|
+
- What history is process noise or stale baggage?
|
|
35
31
|
|
|
36
|
-
|
|
32
|
+
Classify context into:
|
|
37
33
|
|
|
38
|
-
|
|
34
|
+
- **Raw context:** user intent, constraints, code/log/error details, evidence, or plan text you expect to inspect directly soon.
|
|
35
|
+
- **State summary:** decisions, findings, lessons, changed files, validation status, source pointers, rejected leads, and next steps that can replace raw process.
|
|
36
|
+
- **Discardable process:** repetitive searches, verbose logs, abandoned hypotheses, false starts, and unrelated turns whose useful value is already captured or gone.
|
|
39
37
|
|
|
40
|
-
|
|
41
|
-
`context_log`
|
|
42
|
-
2. **START:** Tag the beginning with a semantic name.
|
|
43
|
-
`context_tag({ name: "<task-slug>-start" })` // e.g., `auth-login-start`
|
|
44
|
-
3. **WORK:** Execute steps.
|
|
45
|
-
4. **MILESTONE:** Tag intermediate stable states.
|
|
46
|
-
`context_tag({ name: "<task-slug>-plan" })` // e.g., `auth-login-plan`
|
|
47
|
-
5. **SQUASH (Autonomous):** If history becomes noisy or low-density, **Squash with Backup**.
|
|
48
|
-
* *Action:* `context_checkout({ target: "<task-slug>-start", message: "...", backupTag: "<task-slug>-raw-history" })`
|
|
49
|
-
* *Action (Optional):* `context_tag({ name: "<task-slug>-done" })`
|
|
50
|
-
* *Safety:* If you need the details later, checkout the backup tag.
|
|
38
|
+
If the active context is already small, coherent, and directly useful for the next step, do not manage it just to be tidy.
|
|
51
39
|
|
|
52
|
-
##
|
|
40
|
+
## When to use
|
|
53
41
|
|
|
54
|
-
|
|
55
|
-
| :--- | :--- | :--- | :--- |
|
|
56
|
-
| `context_tag` | `git tag` | Bookmark a stable state. | Before risky changes. Before starting a new task. |
|
|
57
|
-
| `context_log` | `git log` | See where you are. | When you feel lost. To find IDs for checkout. |
|
|
58
|
-
| `context_checkout`| `git reset --soft` | **Time Travel / Squash.** | To undo mistakes. To compress history. |
|
|
42
|
+
Use this mode when the work may outgrow one clean thread:
|
|
59
43
|
|
|
60
|
-
|
|
44
|
+
- search, research, browser work, or reading many files/logs/pages/results
|
|
45
|
+
- investigate -> decide -> execute -> validate
|
|
46
|
+
- plan -> implement -> verify
|
|
47
|
+
- background or asynchronous work, handoffs, user decisions, or delayed results
|
|
48
|
+
- multiple approaches, retries, failed branches, comparisons, or pivots
|
|
49
|
+
- repeated similar cases, tickets, reviews, or batch items
|
|
50
|
+
- a main task that may be interrupted by side tasks
|
|
51
|
+
- repeated progress/status checks that indicate active state is hard to track
|
|
52
|
+
- scattered threads that need cleanup before continuing
|
|
53
|
+
- debugging, troubleshooting, refactoring, migration, or code-facing work that may get noisy
|
|
61
54
|
|
|
62
|
-
|
|
55
|
+
If one of these clearly applies, take a structural action now, usually a checkpoint. Do not merely describe the workflow. If the user has not provided enough task details, still checkpoint the workflow shape before asking clarifying questions.
|
|
63
56
|
|
|
64
|
-
|
|
57
|
+
Usually skip this skill for one-shot reads, bounded summaries, direct rewrites, simple lookups, deterministic scripts, short tasks that can stay clean, or moments where the active context is already a good working set.
|
|
65
58
|
|
|
66
|
-
|
|
59
|
+
## Start-of-turn check
|
|
67
60
|
|
|
68
|
-
|
|
69
|
-
* **phase**: The stage of work (`start`, `plan`, `impl`, `done`, `fail`, `backup`)
|
|
61
|
+
At the start of each new user message, classify it:
|
|
70
62
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
| `pre-research` | `error-log-analysis-start` | Future-you knows the topic |
|
|
75
|
-
| `phase-1-done` | `db-schema-plan-done` | Know which phase of which task |
|
|
76
|
-
| `debug-retry` | `null-pointer-fix-retry` | What bug? |
|
|
63
|
+
- **Same task / next phase:** continue; if the previous phase is complete and noisy, compact before the next phase.
|
|
64
|
+
- **Correction, review, or feedback on recent work:** answer from the raw recent context; do not compact merely to respond. Questions about implementation choices, shortcuts, trade-offs, or known risks are exactly why the completed work should remain inspectable.
|
|
65
|
+
- **New task, explicit next step, or direction shift:** if the previous task left a complete noisy segment, inspect timeline when anchors are unclear, then compact to a continuation anchor that gives the now-known next work a clean working set.
|
|
77
66
|
|
|
78
|
-
|
|
67
|
+
Think of the tools as a phase pipeline: checkpoint marks anchors, work happens, timeline shows structure, and compact creates a new branch from the chosen continuation anchor with a summary of what happened after it. The target is a working-set choice, not an age choice.
|
|
79
68
|
|
|
80
|
-
|
|
81
|
-
| :--- | :--- | :--- |
|
|
82
|
-
| **Start** | `<task>-start` | `auth-jwt-start`, `docker-setup-start` |
|
|
83
|
-
| **Plan** | `<task>-plan` | `api-v2-plan`, `migration-plan` |
|
|
84
|
-
| **Milestone** | `<task>-<milestone>` | `auth-jwt-impl-done`, `tests-passed` |
|
|
85
|
-
| **Backup** | `<task>-raw-history` | `auth-jwt-raw-history` |
|
|
86
|
-
| **Failure** | `<task>-fail-<reason>` | `auth-jwt-fail-timeout` |
|
|
69
|
+
## Main loop
|
|
87
70
|
|
|
88
|
-
|
|
71
|
+
1. Before noisy work, create a semantic checkpoint as the first context-management action. If the first job is orientation over existing history, run `context_timeline` before adding a new checkpoint.
|
|
72
|
+
2. When the task shape is clear, read one matching scenario reference only if it will change tool timing, anchor choice, or summary content. Skip reference loading for obvious short applications where this main skill body is enough.
|
|
73
|
+
3. Add checkpoints at meaningful milestones: phase boundaries, risky attempts, reusable batch methods, and interruptions.
|
|
74
|
+
4. Use `context_timeline` when the active path structure affects the next decision or compact target.
|
|
75
|
+
5. At continuation boundaries, run the compact gate before starting another known phase. If the whole requested task is complete, present the result and wait for feedback; delivery and a request for feedback are not themselves a continuation.
|
|
76
|
+
6. After a successful compact, continue from the injected summary instead of dragging the full raw path forward.
|
|
89
77
|
|
|
90
|
-
|
|
91
|
-
Think of your conversation as a "Feature Branch" full of messy thoughts.
|
|
92
|
-
**You must distinguish Signal from Noise.**
|
|
78
|
+
## Continuation boundaries
|
|
93
79
|
|
|
94
|
-
|
|
95
|
-
* **Noise (Low Value):** Failed attempts, long tool outputs, "thinking" steps. -> **SQUASH.**
|
|
96
|
-
* **Focus on Goal:** Ask yourself: "Does this message help me achieve the current goal?" -> **KEEP.**
|
|
80
|
+
A continuation boundary is a point where the current phase has produced a stable result and the next action will use that result to start a different phase. It is not necessarily the end of the user's whole task.
|
|
97
81
|
|
|
98
|
-
|
|
99
|
-
1. **Task Done:** Convert the messy process into one clean summary.
|
|
100
|
-
2. **Low Density:** You read 2000 lines but only found 1 error.
|
|
82
|
+
Examples: investigation -> decision/plan/implementation, implementation -> validation, failed validation -> next approach, delayed result -> routing/action, received user decision -> execution, rejected branch -> replacement direction, side request -> pause/summarize mainline before switching.
|
|
101
83
|
|
|
102
|
-
|
|
103
|
-
By using `backupTag`, you save the "Messy Branch" forever. You can always checkout the backup tag if the summary isn't enough.
|
|
104
|
-
* **Main Trunk:** Jump back to the summary.
|
|
105
|
-
* **Backup Tag:** Jump back to the raw details.
|
|
84
|
+
Do not ask only "is the whole task done?" Ask "will the next action start a new phase using the stable result of this phase?" If yes, this is often a compaction boundary.
|
|
106
85
|
|
|
107
|
-
|
|
108
|
-
If you fail 3 times:
|
|
109
|
-
1. **STOP.** Don't try a 4th time.
|
|
110
|
-
2. `context_checkout` back to the last safe tag.
|
|
111
|
-
3. Summarize the failure in the checkout message ("Tried X, failed because Y").
|
|
112
|
-
4. Try a new approach from the clean state.
|
|
86
|
+
A response that presents completed work and asks the user for review, feedback, or a decision is **not** a continuation boundary: the next work is unknown, and the user may ask about details from the raw trail. Deliver the result and wait without compacting. Once feedback or an explicit next task arrives, decide whether the resulting known continuation benefits from compaction.
|
|
113
87
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
When `context_checkout` completes and injects a summary, you are in a **new context**.
|
|
117
|
-
|
|
118
|
-
1. **READ** the injected summary carefully
|
|
119
|
-
2. **EXECUTE** the `Next Step` from the summary - this is your new task.
|
|
88
|
+
An actual handoff to a known next actor, process, validation, or queued phase can be a boundary when the next action is defined and needs only stable state. Do not treat a merely possible later user response as that kind of handoff.
|
|
120
89
|
|
|
121
|
-
##
|
|
122
|
-
|
|
123
|
-
| Situation | Action | Reason |
|
|
124
|
-
| :--- | :--- | :--- |
|
|
125
|
-
| **Starting Task** | `context_tag({ name: "<task-slug>-start" })` | Create a rollback point. |
|
|
126
|
-
| **Research / Logs** | `context_checkout` (Squash) | **Process is Noise.** Read 2000 lines -> Keep result. |
|
|
127
|
-
| **Messy Debugging** | **Squash w/ Backup** | **Cleanup.** The error logs are noise once fixed. |
|
|
128
|
-
| **Task Done (Candidate)**| **Squash w/ Backup** | **Assume Success.** Summary is usually enough. Backup exists if not. |
|
|
129
|
-
| **Goal Shift** | `context_checkout` (Squash) | Old context is irrelevant. |
|
|
130
|
-
| **Drift (some steps w/o tag)** | **Tag (Milestone)** | Maintain the skeleton. Don't fly blind. |
|
|
131
|
-
|
|
132
|
-
## The "Context Health" Check
|
|
133
|
-
|
|
134
|
-
If you cannot answer these, run `context_log`:
|
|
90
|
+
## Read the right reference
|
|
135
91
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
**
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
target: "race-condition-fix-start",
|
|
254
|
-
message: "Mutex caused deadlock: Thread A holds mutex, awaits callback; callback needs mutex held by B; B waits for A. Circular wait detected. **Reason**: Trying lock-free CAS approach next. **Important Changes**: `AsyncQueue.ts` lines 70-90 modified (backup saved). **Next Step**: Revert `AsyncQueue.ts` and implement lock-free compare-and-swap approach.",
|
|
255
|
-
backupTag: "race-condition-mutex-fail" // Save the failure for reference
|
|
256
|
-
});
|
|
257
|
-
context_tag({ name: "race-condition-lockfree-start" });
|
|
258
|
-
```
|
|
92
|
+
Read **one primary reference** only when the scenario pattern will affect tool timing, anchor choice, or summary content:
|
|
93
|
+
|
|
94
|
+
- search / research / reading-heavy work -> `references/search-research-and-reading.md`
|
|
95
|
+
- development / debugging / troubleshooting / refactoring / migration -> `references/development-and-troubleshooting.md`
|
|
96
|
+
- planning / staged execution / todo-driven work -> `references/planning-and-execution.md`
|
|
97
|
+
- repeated similar items / batch work -> `references/repeated-items-and-batch-work.md`
|
|
98
|
+
- task switching / pause-resume / interruptions / cleanup-and-continue -> `references/task-switching-and-cleanup.md`
|
|
99
|
+
- interleaved async work / overlapping fronts / background results / user decisions -> `references/interleaved-async-work.md`
|
|
100
|
+
|
|
101
|
+
Also read `references/retry-branch-and-pivot.md` when multiple approaches, failed branches, comparisons, retries, or pivots become central.
|
|
102
|
+
|
|
103
|
+
## Tool policy
|
|
104
|
+
|
|
105
|
+
### `context_checkpoint`
|
|
106
|
+
|
|
107
|
+
Use before noisy work, a new phase, a risky attempt, switching subtasks, or after a meaningful milestone. Use semantic names such as `<task>-start`, `<task>-<phase>`, `<task>-<attempt>`, or `<task>-<milestone>`. Avoid generic names like `start`, `checkpoint-1`, or `retry`.
|
|
108
|
+
|
|
109
|
+
### `context_timeline`
|
|
110
|
+
|
|
111
|
+
Use it as the structural view of the active path:
|
|
112
|
+
|
|
113
|
+
- when the current path shape affects the next decision
|
|
114
|
+
- when several checkpoints, branches, or task switches exist
|
|
115
|
+
- before choosing a non-obvious compact target
|
|
116
|
+
- when the thread feels cluttered and you need to distinguish useful context from baggage
|
|
117
|
+
|
|
118
|
+
When reading the timeline, ask which raw messages are still needed for the immediate next action, which paths are now baggage, and which anchor gives the smallest sufficient working set after summary injection.
|
|
119
|
+
|
|
120
|
+
### `context_compact`
|
|
121
|
+
|
|
122
|
+
Use it to replace raw history with a state summary when the next phase would benefit from a smaller working set.
|
|
123
|
+
|
|
124
|
+
Typical compact boundaries: investigation -> execution, diagnosis -> fix, implementation -> validation, failed attempt -> next attempt, representative item -> remaining batch, completed noisy task -> a newly received user task.
|
|
125
|
+
|
|
126
|
+
Strong signals to consider compaction:
|
|
127
|
+
|
|
128
|
+
- repeated progress/status checks
|
|
129
|
+
- inability to summarize current state, next action, and open risks in one short paragraph
|
|
130
|
+
- rejected, abandoned, or superseded branches
|
|
131
|
+
- stable result after many tool calls or long output
|
|
132
|
+
- returned background/asynchronous/delegated result
|
|
133
|
+
- material plan or approach change
|
|
134
|
+
- side question arriving while stale process history is active
|
|
135
|
+
|
|
136
|
+
Do not compact while exploration is still active, when the result is unstable, just because the skill triggered, or just because the user-visible task ended.
|
|
137
|
+
|
|
138
|
+
## Compact gate
|
|
139
|
+
|
|
140
|
+
Before calling `context_compact`, require all three:
|
|
141
|
+
|
|
142
|
+
1. The segment being left behind is noisy, stale, failed, low-value in raw form, or actively reducing focus.
|
|
143
|
+
2. You can restore the useful task state in a clear summary.
|
|
144
|
+
3. There is an immediate, known continuation that benefits from cleaner context—not merely a possible user response or feedback request.
|
|
145
|
+
|
|
146
|
+
If the compact is prompted by a new user message, a direction shift, or several possible checkpoint targets, run `context_timeline` first and choose the target from visible structure rather than memory.
|
|
147
|
+
|
|
148
|
+
If the whole task is done, present the result and wait. Do not compact before or while asking for feedback, review, approval, or the user's next instruction. Compact later only after that message establishes a concrete continuation and cleanup is useful.
|
|
149
|
+
|
|
150
|
+
Checkpoint-only failure mode: a checkpoint is useful because it gives you a clean anchor to compact back to later. After any checkpointed phase produces a stable result, ask what the phase settled, whether the next step is different, and whether a summary can replace the raw trail. If yes, compact; do not keep accumulating raw history just because the overall task is still active.
|
|
151
|
+
|
|
152
|
+
## Choosing target and backup
|
|
153
|
+
|
|
154
|
+
Choose the continuation anchor by designing the next working set:
|
|
155
|
+
|
|
156
|
+
1. Name the immediate next action.
|
|
157
|
+
2. Decide what must remain raw: active user intent, current constraints, still-open evidence/code context, an approved plan being executed, or details you expect to inspect directly next.
|
|
158
|
+
3. Decide what can become state summary or disappear: completed searches, verbose logs, failed attempts, stale branches, earlier unrelated tasks, externally recoverable data, and clear process details.
|
|
159
|
+
4. Pick the anchor that leaves the new branch with the **smallest sufficient context** after summary injection.
|
|
160
|
+
5. If an older anchor plus a stronger summary is cleaner than a recent anchor plus stale context, prefer the older anchor. When completed fronts fill the middle of the thread, it can be correct to compact to a much older anchor or even `root` if the summary restores the active front and source pointers.
|
|
161
|
+
|
|
162
|
+
Avoid targets that are too late, too early with a weak summary, or semantically wrong. If there are several checkpoints, a task switch, or uncertainty about the best working set, run `context_timeline` first.
|
|
163
|
+
|
|
164
|
+
Use `backupCheckpoint` when raw history may still matter later. A backup is a recovery safety net, not a substitute for the summary.
|
|
165
|
+
|
|
166
|
+
## Compact summary contract
|
|
167
|
+
|
|
168
|
+
The summary is not a transcript recap. It is the state needed to resume work from the chosen anchor; older or cleaner anchors require stronger summaries.
|
|
169
|
+
|
|
170
|
+
Context tools change conversation state, not the outside world. Files, processes, browser state, tickets, databases, remote services, and other side effects stay current. If you compact to an anchor before those changes, the summary must bridge the gap between old conversation context and current external state.
|
|
171
|
+
|
|
172
|
+
A compact summary must restore:
|
|
173
|
+
|
|
174
|
+
1. **Task state:** current task, user intent, constraints, decisions, assumptions, known result/progress/failure, and—when relevant—deliberate shortcuts, temporary workarounds, trade-offs, known limitations, and questions still awaiting user feedback.
|
|
175
|
+
2. **External state:** changed files, created/deleted artifacts, running/stopped processes, browser actions, tickets/records, deployments, remote changes.
|
|
176
|
+
3. **Verification state:** commands already run, validation status, notable outputs, and remaining risks or open questions.
|
|
177
|
+
4. **Navigation state:** source anchors/evidence when needed, rejected leads worth avoiding, backup checkpoint guidance, and explicit next step.
|
|
178
|
+
|
|
179
|
+
If important data has a reliable external source, preserve the pointer and retrieval method rather than copying the raw data. Examples: file path and line/query, database table/query, task/job id, log path, URL, record id, branch/commit, or command to inspect status. Include raw values only when they are small, unstable, hard to retrieve, or needed for immediate reasoning.
|
|
180
|
+
|
|
181
|
+
For long-running work, shape the summary as a state capsule: goal, stable result, decisions, rejected paths, current artifacts/source pointers, active work, pending input, risks/open questions, and next action. Include why compacting is appropriate only when it helps future orientation. Avoid vague summaries like `Done`, `Investigated`, `Switching context`, or `Going back`.
|
|
182
|
+
|
|
183
|
+
Before compacting, quickly check: stable state? real continuation? smallest sufficient working set? summary restores state after the anchor? externally recoverable data represented by pointers? external side effects and validation captured? explicit next step?
|
|
184
|
+
|
|
185
|
+
## After compact
|
|
186
|
+
|
|
187
|
+
1. Read the injected summary carefully and treat it as the new active state.
|
|
188
|
+
2. Verify it contains enough state for the next action.
|
|
189
|
+
3. Remember that disk and external systems were not rolled back; inspect current files/tools/services when state matters.
|
|
190
|
+
4. If a missing detail is cheap to reconstruct from disk, tools, or source anchors, retrieve it directly.
|
|
191
|
+
5. Return to the backup checkpoint only when the missing raw context cannot be reconstructed cheaply.
|
|
192
|
+
|
|
193
|
+
## Common mistakes
|
|
194
|
+
|
|
195
|
+
Avoid:
|
|
196
|
+
|
|
197
|
+
- checkpointing constantly without phase meaning
|
|
198
|
+
- checkpointing early but never compacting after a stable phase result
|
|
199
|
+
- compacting blindly without timeline when anchor choice is unclear
|
|
200
|
+
- preserving too much raw history because older anchors or `root` feel risky
|
|
201
|
+
- using an old anchor or `root` with a weak summary
|
|
202
|
+
- compacting before presenting a final deliverable or while awaiting user feedback, approval, or review
|
|
203
|
+
- compacting immediately after a final deliverable when no next user intent is known
|
|
204
|
+
- carrying completed noisy phases into a new task
|
|
205
|
+
- treating handoff or decision prompts as final answers when a continuation is expected
|
|
206
|
+
- writing summaries that recap history but fail to restore current task state
|
|
207
|
+
- assuming compact or branch navigation reverts files, processes, browser state, or remote services
|
|
208
|
+
- omitting decisions, constraints, external side effects, changed files, validation status, or next step
|