@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
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Development and Troubleshooting
|
|
2
|
+
|
|
3
|
+
Use this reference for long-running:
|
|
4
|
+
- implementation
|
|
5
|
+
- debugging
|
|
6
|
+
- troubleshooting
|
|
7
|
+
- refactoring
|
|
8
|
+
- migration
|
|
9
|
+
- review or audit work
|
|
10
|
+
|
|
11
|
+
These tasks often stay cleaner when treated as stages with anchors, instead of one uninterrupted thread. If multiple alternative approaches, failed branches, or route comparisons become central, also read `retry-branch-and-pivot.md`.
|
|
12
|
+
|
|
13
|
+
## Working pattern
|
|
14
|
+
|
|
15
|
+
1. Create a checkpoint before starting serious work.
|
|
16
|
+
2. Add checkpoints before risky edits, new approaches, or major phase changes.
|
|
17
|
+
3. Review the timeline when you need to understand the current shape of the work.
|
|
18
|
+
4. Compact after a stable implementation milestone, a failed approach, or a completed troubleshooting phase when there is another known phase, attempt, validation step, or task switch that benefits from cleanup. If files, processes, or external systems changed, include those side effects in the summary because context navigation does not roll them back. If the completed phase is the final user-visible deliverable, present it and wait for feedback or the next instruction; do not compact merely because you asked for review.
|
|
19
|
+
|
|
20
|
+
## Typical checkpoint moments
|
|
21
|
+
|
|
22
|
+
Checkpoint:
|
|
23
|
+
- before starting implementation
|
|
24
|
+
- before a risky refactor
|
|
25
|
+
- before trying an alternative fix
|
|
26
|
+
- after a milestone like "root cause confirmed" or "first pass implemented"
|
|
27
|
+
- before switching to a side task
|
|
28
|
+
|
|
29
|
+
Example checkpoint names:
|
|
30
|
+
- `parser-fix-start`
|
|
31
|
+
- `cache-refactor-attempt-2`
|
|
32
|
+
- `migration-plan-ready`
|
|
33
|
+
- `incident-root-cause-confirmed`
|
|
34
|
+
|
|
35
|
+
## Timeline review moments
|
|
36
|
+
|
|
37
|
+
Run `context_timeline` when:
|
|
38
|
+
- multiple attempts now exist
|
|
39
|
+
- the task moved from diagnosis to implementation
|
|
40
|
+
- you are about to abandon one approach and restart from another anchor
|
|
41
|
+
- you are unsure which checkpoint best represents the clean continuation point
|
|
42
|
+
|
|
43
|
+
## Compact patterns
|
|
44
|
+
|
|
45
|
+
### After a failed attempt
|
|
46
|
+
|
|
47
|
+
Use compact when an attempt clearly failed and you have a crisp summary of why.
|
|
48
|
+
|
|
49
|
+
```javascript
|
|
50
|
+
context_compact({
|
|
51
|
+
target: "memory-leak-fix-start",
|
|
52
|
+
summary: "Current task: continue the memory leak fix. State: WeakRef approach failed because objects were collected too early and cache hit rate collapsed. Decision: abandon WeakRef and try object pooling. Next step: implement the object-pooling approach.",
|
|
53
|
+
backupCheckpoint: "memory-leak-weakref-raw-history"
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### After a completed phase
|
|
58
|
+
|
|
59
|
+
Use compact when a phase is done and a known next phase would work better from a focused state summary than from the raw implementation/debugging trail. Do not use this as a reflexive final step before or after delivering finished work: preserve the raw trail while awaiting review, feedback, or a decision. Compact only when validation, a next phase, a next attempt, or a newly received user task makes the continuation concrete.
|
|
60
|
+
|
|
61
|
+
```javascript
|
|
62
|
+
context_compact({
|
|
63
|
+
target: "parser-fix-start",
|
|
64
|
+
summary: "Current task: validate the parser fix. State: implementation is done and the debugging trail can be summarized. External state: parser implementation and related tests were changed on disk; context navigation did not revert them. Validation not yet run after final edit. Next step: run targeted validation and summarize remaining edge cases.",
|
|
65
|
+
backupCheckpoint: "parser-fix-debug-history"
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Warning signs
|
|
70
|
+
|
|
71
|
+
Switch into stronger context-management behavior when:
|
|
72
|
+
- you are accumulating many partial theories
|
|
73
|
+
- the thread contains multiple fix attempts
|
|
74
|
+
- you keep revisiting earlier reasoning
|
|
75
|
+
- the next step is clear but the path behind it is getting noisy
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# Interleaved Async Work
|
|
2
|
+
|
|
3
|
+
Use this reference when the hard part is **not** the external worker itself, but the current agent carrying several overlapping lines of work in one conversation.
|
|
4
|
+
|
|
5
|
+
Common examples:
|
|
6
|
+
|
|
7
|
+
- a main task continues while background jobs, subagents, reviewers, or tools may return later
|
|
8
|
+
- the user asks side questions while another front is still active
|
|
9
|
+
- progress updates, returned results, decisions, and new work are interleaved in the same thread
|
|
10
|
+
- several pending fronts have different next actions, and raw history starts making the current state hard to see
|
|
11
|
+
|
|
12
|
+
This is context management for the current agent. It is not a subagent-management policy. The goal is to keep the current working set clear enough to answer: **what am I doing now, what is parked, what just returned, and what raw context is still needed?**
|
|
13
|
+
|
|
14
|
+
## Mental model: fronts
|
|
15
|
+
|
|
16
|
+
Treat each overlapping line of work as a **front**.
|
|
17
|
+
|
|
18
|
+
A front may be:
|
|
19
|
+
|
|
20
|
+
- the current user-facing task
|
|
21
|
+
- a paused mainline task
|
|
22
|
+
- a background command or long-running job
|
|
23
|
+
- a subagent/reviewer/collaborator result that may return later
|
|
24
|
+
- a pending user decision
|
|
25
|
+
- a side request that should be answered before resuming the mainline
|
|
26
|
+
|
|
27
|
+
For each front, keep only one of these in the active working set:
|
|
28
|
+
|
|
29
|
+
- **Active raw front:** the thing you are reasoning about right now; keep necessary raw details.
|
|
30
|
+
- **Parked state capsule:** a paused or waiting front summarized by goal, current state, source pointers, next action, and blockers.
|
|
31
|
+
- **Stale process:** old logs, retries, status chatter, and abandoned paths whose lesson has already been captured.
|
|
32
|
+
|
|
33
|
+
The mistake to avoid is carrying every front raw at once.
|
|
34
|
+
|
|
35
|
+
## Working pattern
|
|
36
|
+
|
|
37
|
+
1. Identify the active front before each substantial reply or tool call.
|
|
38
|
+
2. If another front is still pending, keep it as a small state capsule rather than raw history.
|
|
39
|
+
3. When a result returns, capture it into the relevant front before responding.
|
|
40
|
+
4. If the returned result does not become the active front immediately, park it as state and preserve the user's current focus.
|
|
41
|
+
5. Before switching fronts, compact if the old front's raw process is now stale and the next front can continue from a summary.
|
|
42
|
+
6. If several fronts are tangled, run `context_timeline` to find the clean anchor and separate active, parked, completed, and stale paths.
|
|
43
|
+
|
|
44
|
+
## What to record per parked front
|
|
45
|
+
|
|
46
|
+
Use a short capsule:
|
|
47
|
+
|
|
48
|
+
- Front: short name for this line of work
|
|
49
|
+
- Goal: what this front is trying to accomplish
|
|
50
|
+
- State: waiting / running / returned / blocked / ready for next phase
|
|
51
|
+
- Latest stable result: what is known now
|
|
52
|
+
- Source pointers: files, links, task ids, log paths, branches, records, queries, or commands that identify where to re-check details
|
|
53
|
+
- Decisions and constraints: choices already made that still matter
|
|
54
|
+
- Rejected paths: approaches that should not be repeated
|
|
55
|
+
- Pending input or trigger: what would make this front active again
|
|
56
|
+
- Next action: what to do when resuming this front
|
|
57
|
+
|
|
58
|
+
This capsule is for future-you, not for the external worker. It should be enough to resume without rereading the interleaved raw thread.
|
|
59
|
+
|
|
60
|
+
If a front's detailed state is available from a reliable external source, keep the pointer, not the dump. For example, store the task id plus the command/log path to inspect it, not pages of status output; store the database query or record id, not every row; store the file path and relevant section, not the whole file. Copy raw details only when they are small, volatile, hard to retrieve, or needed for immediate reasoning.
|
|
61
|
+
|
|
62
|
+
## When to compact
|
|
63
|
+
|
|
64
|
+
Compact when interleaving has made raw context a worse working set:
|
|
65
|
+
|
|
66
|
+
- you are switching from one front to another after a noisy phase
|
|
67
|
+
- a side request arrives while the mainline is noisy but resumable from a capsule
|
|
68
|
+
- a background/subagent/reviewer/tool result returned and its raw logs are no longer needed
|
|
69
|
+
- the user has asked for status more than once and you cannot state all active fronts briefly
|
|
70
|
+
- a front was rejected, superseded, completed, or parked indefinitely
|
|
71
|
+
- the next action belongs to a different front than the recent raw history
|
|
72
|
+
- the active front started much earlier, and the middle of the thread is mostly completed or unrelated fronts
|
|
73
|
+
|
|
74
|
+
Do **not** compact just because async work exists. Compact when a front can safely be represented as state while another front becomes active.
|
|
75
|
+
|
|
76
|
+
## Choosing how far back to compact
|
|
77
|
+
|
|
78
|
+
Interleaved work often makes recent anchors poor targets: they may preserve the completed fronts that happened after the active front was launched. Be willing to compact aggressively when the summary can restore state.
|
|
79
|
+
|
|
80
|
+
A compact to an old anchor or even `root` is appropriate when:
|
|
81
|
+
|
|
82
|
+
- the active front can be described by a concise capsule
|
|
83
|
+
- completed fronts between the anchor and now no longer need raw context
|
|
84
|
+
- important details are recoverable from reliable source pointers
|
|
85
|
+
- the next action does not require inspecting the interleaved raw discussion
|
|
86
|
+
- you can name what remains active, what is parked, and what is done
|
|
87
|
+
|
|
88
|
+
Use a backup checkpoint for safety when the interleaved raw path may still matter, but do not keep it active just because it is long.
|
|
89
|
+
|
|
90
|
+
Before a deep compact, ask:
|
|
91
|
+
|
|
92
|
+
```text
|
|
93
|
+
Active now: which front am I resuming?
|
|
94
|
+
Parked: which fronts still wait for input/result?
|
|
95
|
+
Done: which fronts can be summarized or omitted?
|
|
96
|
+
Pointers: where can I re-check authoritative details?
|
|
97
|
+
Next: what is the immediate action after compacting?
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Handling returned results
|
|
101
|
+
|
|
102
|
+
When a delayed result appears in the middle of another thread:
|
|
103
|
+
|
|
104
|
+
1. **Capture:** identify which front it belongs to and summarize its result.
|
|
105
|
+
2. **Classify:** progress, stable completion, failure, decision needed, or noise.
|
|
106
|
+
3. **Choose focus:** decide whether this result should interrupt the current active front. If not, park it.
|
|
107
|
+
4. **Compact if needed:** if switching to it or away from it would drag stale logs/retries forward, compact first.
|
|
108
|
+
5. **Continue:** resume the chosen active front from a clean working set.
|
|
109
|
+
|
|
110
|
+
## Example capsules
|
|
111
|
+
|
|
112
|
+
```text
|
|
113
|
+
Front: import-test-flake
|
|
114
|
+
Goal: fix flaky import tests.
|
|
115
|
+
State: reviewer returned findings.
|
|
116
|
+
Latest stable result: fixed sleeps were rejected; signed retry strategy is still viable.
|
|
117
|
+
Source pointers: branch retry-import-tests, log tmp/import-flake.log.
|
|
118
|
+
Pending input or trigger: decide whether to implement bounded retries.
|
|
119
|
+
Next action: if accepted, implement bounded retry and rerun targeted tests.
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
```text
|
|
123
|
+
Front: docs-build
|
|
124
|
+
Goal: validate generated documentation before publishing.
|
|
125
|
+
State: background build running.
|
|
126
|
+
Latest stable result: source edits complete; validation not yet known.
|
|
127
|
+
Source pointers: task docs-build, output dist/docs/.
|
|
128
|
+
Pending input or trigger: build exit status.
|
|
129
|
+
Next action: on success, summarize validation; on failure, inspect first build/link error.
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Common mistakes
|
|
133
|
+
|
|
134
|
+
Avoid:
|
|
135
|
+
|
|
136
|
+
- treating async/subagent management as the goal instead of keeping the current agent's working set clear
|
|
137
|
+
- carrying several fronts raw at once
|
|
138
|
+
- copying externally recoverable status dumps instead of preserving reliable source pointers
|
|
139
|
+
- letting a returned result overwrite the user's current active request without deciding focus
|
|
140
|
+
- reporting status repeatedly while the real problem is that fronts are not summarized
|
|
141
|
+
- compacting away a front without preserving how to resume it
|
|
142
|
+
- avoiding a deep compact even though source pointers and capsules can restore the active state
|
|
143
|
+
- resuming from memory when a small front capsule would be safer
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Planning and Execution
|
|
2
|
+
|
|
3
|
+
Use this reference when the work is organized around an explicit execution frame, such as:
|
|
4
|
+
- a formal implementation or migration plan
|
|
5
|
+
- a roadmap with multiple milestones
|
|
6
|
+
- a lightweight todo list or checklist
|
|
7
|
+
- staged execution that will be revisited, updated, or reordered across many turns
|
|
8
|
+
|
|
9
|
+
The defining feature here is not just that the work has phases. It is that execution repeatedly returns to an explicit plan, roadmap, or todo baseline.
|
|
10
|
+
|
|
11
|
+
## Two common variants
|
|
12
|
+
|
|
13
|
+
### Formal plan
|
|
14
|
+
Examples:
|
|
15
|
+
- a plan produced by a planning step or planning agent
|
|
16
|
+
- a migration plan with several services or phases
|
|
17
|
+
- a rollout plan with checkpoints and validation steps
|
|
18
|
+
|
|
19
|
+
### Lightweight todo / checklist
|
|
20
|
+
Examples:
|
|
21
|
+
- a short task list for a refactor
|
|
22
|
+
- a checklist for a release or audit
|
|
23
|
+
- a small execution outline that will be worked through item by item
|
|
24
|
+
|
|
25
|
+
Both variants use the same context-management rhythm.
|
|
26
|
+
|
|
27
|
+
## Working pattern
|
|
28
|
+
|
|
29
|
+
1. Create or confirm the plan / todo list.
|
|
30
|
+
2. Create a checkpoint for the clean plan-ready state.
|
|
31
|
+
3. Execute one subtask or phase.
|
|
32
|
+
4. If that subtask becomes noisy, let it get noisy locally.
|
|
33
|
+
5. Once the subtask produces a stable takeaway and another subtask or phase remains, compact to the anchor that gives the next subtask the cleanest sufficient working set, often the plan-ready or phase-start anchor.
|
|
34
|
+
6. Continue with the next subtask from that focused working set.
|
|
35
|
+
7. If the plan changes materially, checkpoint the updated plan state again.
|
|
36
|
+
8. If the last subtask completes the user's whole request, give the final answer without an automatic compact and retain the raw trail for review or feedback. Decide on cleanup only when a later message establishes a new task or explicit next phase.
|
|
37
|
+
|
|
38
|
+
## Useful anchors
|
|
39
|
+
|
|
40
|
+
Example checkpoint names:
|
|
41
|
+
- `auth-migration-plan-ready`
|
|
42
|
+
- `release-rollout-plan-ready`
|
|
43
|
+
- `parser-refactor-todo-baseline`
|
|
44
|
+
- `cleanup-phase-2-start`
|
|
45
|
+
- `vendor-audit-milestone-1`
|
|
46
|
+
|
|
47
|
+
## When to review timeline
|
|
48
|
+
|
|
49
|
+
Run `context_timeline` when:
|
|
50
|
+
- several subtasks have already been executed
|
|
51
|
+
- the plan has changed more than once
|
|
52
|
+
- multiple branches now exist under the same plan
|
|
53
|
+
- you are unsure whether the next subtask needs the overall plan, the current phase context, or only a summary
|
|
54
|
+
|
|
55
|
+
## When to compact
|
|
56
|
+
|
|
57
|
+
Compact when:
|
|
58
|
+
- a subtask is complete, another subtask remains, and its raw execution path is no longer worth keeping active
|
|
59
|
+
- a phase finished and the next phase should start from a cleaner state
|
|
60
|
+
- the plan remains valid but the current execution segment has become noisy
|
|
61
|
+
- a later user message starts a new task after the plan-driven task completed noisily
|
|
62
|
+
|
|
63
|
+
Do not compact just because a todo list exists. Compact when a specific execution segment has already served its purpose and can be compacted for an actual continuation. If the segment changed files, launched/stopped processes, or updated external systems, record those side effects in the summary; context navigation does not revert them.
|
|
64
|
+
|
|
65
|
+
## Replan
|
|
66
|
+
|
|
67
|
+
If the plan itself changes materially:
|
|
68
|
+
1. finish or abandon the current noisy segment
|
|
69
|
+
2. summarize the change in direction
|
|
70
|
+
3. checkpoint the new plan-ready state
|
|
71
|
+
4. continue from the updated plan anchor
|
|
72
|
+
|
|
73
|
+
If the plan change is driven by failed branches or strategy shifts, also read `retry-branch-and-pivot.md`.
|
|
74
|
+
|
|
75
|
+
## Common mistakes
|
|
76
|
+
|
|
77
|
+
Avoid:
|
|
78
|
+
- keeping every finished subtask's raw reasoning active instead of preserving only the reusable state
|
|
79
|
+
- choosing an anchor that drops the current plan state without preserving it in the summary
|
|
80
|
+
- failing to checkpoint the updated plan after a major replan
|
|
81
|
+
- confusing repeated-item work with plan-driven work when the subtasks are actually different in nature
|
package/extensions/dm-context/skills/context-management/references/repeated-items-and-batch-work.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Repeated Items and Batch Work
|
|
2
|
+
|
|
3
|
+
Use this reference when the work involves many similar items handled over many turns, such as:
|
|
4
|
+
- repeated cases
|
|
5
|
+
- repeated tickets
|
|
6
|
+
- repeated reviews
|
|
7
|
+
- repeated checks
|
|
8
|
+
- repeated fix attempts on similar inputs
|
|
9
|
+
|
|
10
|
+
Use this reference when the items are similar enough that the same method should be reused across them. If the subtasks are heterogeneous and anchored to a roadmap or todo baseline, use `planning-and-execution.md` instead.
|
|
11
|
+
|
|
12
|
+
## Working pattern
|
|
13
|
+
|
|
14
|
+
1. Create a checkpoint at the start of the overall repeated-item task.
|
|
15
|
+
2. If item 1 teaches you a reusable approach, checkpoint again after that approach becomes clear.
|
|
16
|
+
3. Work item by item.
|
|
17
|
+
4. Compact after each completed item or completed mini-phase when another item remains and the raw path is no longer worth carrying forward.
|
|
18
|
+
5. Use timeline occasionally to verify that the history still has a clean structure.
|
|
19
|
+
|
|
20
|
+
For repeated-item work, the default between-item move is not "keep carrying the last item's raw reasoning". Once an item is done, its takeaway is stable, and another item remains, compact to the repeated-work anchor or other baseline that preserves the reusable method without item-specific noise. If the last item completes the whole user request, deliver the final answer and retain the raw trail for review or feedback; decide whether to compact only after a later message establishes new work or an explicit next phase.
|
|
21
|
+
|
|
22
|
+
## Useful anchors
|
|
23
|
+
|
|
24
|
+
Example checkpoint names:
|
|
25
|
+
- `vendor-review-start`
|
|
26
|
+
- `vendor-review-method-clear`
|
|
27
|
+
- `ticket-triage-batch-start`
|
|
28
|
+
- `ticket-triage-pattern-1-confirmed`
|
|
29
|
+
|
|
30
|
+
## When to review timeline
|
|
31
|
+
|
|
32
|
+
Run `context_timeline` when:
|
|
33
|
+
- several items have already been processed
|
|
34
|
+
- item-level work has created multiple branches or compactions
|
|
35
|
+
- you want to confirm that the overall pattern still looks clean
|
|
36
|
+
- you are about to choose which anchor repeated work should keep returning to
|
|
37
|
+
|
|
38
|
+
## When to compact
|
|
39
|
+
|
|
40
|
+
Compact after:
|
|
41
|
+
- a representative item produced a reusable method and the batch will continue
|
|
42
|
+
- a single item is complete, another item remains, and the raw path should be compacted
|
|
43
|
+
- an item-specific dead end is understood and should not remain active in full
|
|
44
|
+
- a new user message arrives after the batch completed, and the batch's raw path is stale baggage for the new task
|
|
45
|
+
|
|
46
|
+
## Example rhythm
|
|
47
|
+
|
|
48
|
+
```javascript
|
|
49
|
+
context_checkpoint({ name: "vendor-review-start" });
|
|
50
|
+
|
|
51
|
+
// ... work through first representative item ...
|
|
52
|
+
|
|
53
|
+
context_checkpoint({ name: "vendor-review-method-clear" });
|
|
54
|
+
|
|
55
|
+
// ... process another item ...
|
|
56
|
+
|
|
57
|
+
context_compact({
|
|
58
|
+
target: "vendor-review-method-clear",
|
|
59
|
+
summary: "Current task: continue the vendor review batch. State: one more vendor review is complete; item-specific reasoning no longer needs to stay raw. Reusable method remains the active baseline. Next step: process the next vendor using the same method.",
|
|
60
|
+
backupCheckpoint: "vendor-review-item-7-history"
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Warning signs
|
|
65
|
+
|
|
66
|
+
Use stronger checkpoint/timeline/compact discipline when:
|
|
67
|
+
- each item creates lots of local reasoning
|
|
68
|
+
- you are starting to confuse one item's path with another's
|
|
69
|
+
- the repeated work is stretching across many turns
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Retry, Branch, and Pivot
|
|
2
|
+
|
|
3
|
+
Use this reference when multiple approaches are being tried and abandoned cleanly, such as:
|
|
4
|
+
- trying A / B / C approaches
|
|
5
|
+
- failed branches that should not pollute the main line
|
|
6
|
+
- compare-and-choose work
|
|
7
|
+
- strategy pivots or goal shifts
|
|
8
|
+
- restarting from a focused working set after a dead end
|
|
9
|
+
|
|
10
|
+
This is a **cross-cutting pattern reference**. Read it alongside a primary reference such as search/research, development/troubleshooting, or planning/execution when branch behavior becomes central.
|
|
11
|
+
|
|
12
|
+
## Working pattern
|
|
13
|
+
|
|
14
|
+
1. Checkpoint before opening a risky branch or alternative path.
|
|
15
|
+
2. Explore or implement that branch.
|
|
16
|
+
3. If anchor choice becomes unclear, inspect timeline.
|
|
17
|
+
4. Once the branch produces a stable lesson, decision, or dead-end, compact to the anchor that removes branch noise while preserving the state needed for the next attempt.
|
|
18
|
+
5. Continue with the next branch or the chosen direction from that focused state.
|
|
19
|
+
|
|
20
|
+
## When to review timeline
|
|
21
|
+
|
|
22
|
+
Run `context_timeline` when:
|
|
23
|
+
- multiple branches now exist
|
|
24
|
+
- you are unsure which branch actually stayed useful
|
|
25
|
+
- you need to choose which pre-branch or older anchor gives the next attempt the best working set
|
|
26
|
+
- the next direction is clear but the old branch still clutters active context
|
|
27
|
+
|
|
28
|
+
## When to compact
|
|
29
|
+
|
|
30
|
+
Compact when:
|
|
31
|
+
- a branch clearly failed
|
|
32
|
+
- a comparison is complete and one option won
|
|
33
|
+
- the direction changed enough that the old path is now baggage
|
|
34
|
+
- the next attempt should start from a focused state rather than the raw failed branch
|
|
35
|
+
|
|
36
|
+
When compacting after an abandoned branch, preserve:
|
|
37
|
+
|
|
38
|
+
- what was tried
|
|
39
|
+
- why it failed or was rejected
|
|
40
|
+
- what should not be repeated
|
|
41
|
+
- what remains valid
|
|
42
|
+
- the chosen next approach
|
|
43
|
+
|
|
44
|
+
## Strategy pivot
|
|
45
|
+
|
|
46
|
+
Use this pattern when the old direction no longer makes sense even though the task is still continuing.
|
|
47
|
+
|
|
48
|
+
Examples:
|
|
49
|
+
- the original approach is no longer viable
|
|
50
|
+
- the user's priority changed
|
|
51
|
+
- the scope narrowed or widened enough that old execution noise is now baggage
|
|
52
|
+
|
|
53
|
+
In these cases:
|
|
54
|
+
- summarize what still matters
|
|
55
|
+
- compact to the anchor that removes the stale branch while preserving current task state
|
|
56
|
+
- continue under the new direction
|
|
57
|
+
|
|
58
|
+
## Example rhythm
|
|
59
|
+
|
|
60
|
+
```javascript
|
|
61
|
+
context_checkpoint({ name: "oauth-fix-start" });
|
|
62
|
+
|
|
63
|
+
// ... try cookie-based approach ...
|
|
64
|
+
|
|
65
|
+
context_compact({
|
|
66
|
+
target: "oauth-fix-start",
|
|
67
|
+
summary: "Current task: continue the OAuth fix with a new approach. State: cookie-based approach is not viable because the callback flow loses session continuity. Rejected path: do not repeat cookie-based continuity for this flow. Still valid: callback validation and provider config findings. Decision: switch to signed state tokens. Next step: implement the signed-state approach.",
|
|
68
|
+
backupCheckpoint: "oauth-cookie-approach-history"
|
|
69
|
+
});
|
|
70
|
+
context_checkpoint({ name: "oauth-signed-state-start" });
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Common mistakes
|
|
74
|
+
|
|
75
|
+
Avoid:
|
|
76
|
+
- opening alternative branches without a clean checkpoint first
|
|
77
|
+
- dragging failed branches forward after their lesson is already clear
|
|
78
|
+
- omitting the rejected path, failure reason, or chosen replacement from the compact summary
|
|
79
|
+
- compacting to a point that still includes the branch you meant to abandon
|
|
80
|
+
- treating every branch as equally worth preserving
|
package/extensions/dm-context/skills/context-management/references/search-research-and-reading.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Search, Research, and Reading
|
|
2
|
+
|
|
3
|
+
Use this reference when the work is mainly driven by large amounts of input material, such as:
|
|
4
|
+
- searching
|
|
5
|
+
- research
|
|
6
|
+
- web search
|
|
7
|
+
- browser-driven information gathering
|
|
8
|
+
- reading many files, logs, docs, webpages, or web results
|
|
9
|
+
- review-heavy reading
|
|
10
|
+
- comparison-heavy reading
|
|
11
|
+
- audit or inspection across many sources
|
|
12
|
+
|
|
13
|
+
This reference is for **input-heavy work where the process is much larger than the final conclusion**. It is especially relevant for web search and browser/page reading, where the information density is often low and the raw trail becomes stale quickly. If the main anchor is an explicit plan or todo list, use `planning-and-execution.md` instead.
|
|
14
|
+
|
|
15
|
+
## Working pattern
|
|
16
|
+
|
|
17
|
+
1. Create a checkpoint before a large search or reading loop.
|
|
18
|
+
2. Search, browse, read, inspect, and follow leads normally.
|
|
19
|
+
3. If you lose orientation, review the timeline.
|
|
20
|
+
4. Once the investigation yields a stable finding and there is another step to take, compact to the anchor that gives the next step a focused working set.
|
|
21
|
+
5. Continue with the conclusion, recommendation, or next action instead of carrying the entire raw exploration forward. If the finding is the final answer to the user's current request, answer first and wait; compact on the next user message if it starts new work.
|
|
22
|
+
|
|
23
|
+
Do not stop at "I already made a checkpoint" if the investigation phase is complete and the conversation is continuing. The cleanup move for completed research is usually a compact to the anchor that preserves only the raw context the next step still needs.
|
|
24
|
+
|
|
25
|
+
**Important:** “another step” includes the next phase of the same request. If you searched to find the right data source, previous task record, API shape, rule id, or query pattern, then the next execution step (running the real query/export, implementing, validating, etc.) is an immediate continuation. Compact before that execution step, not only before a future user message.
|
|
26
|
+
|
|
27
|
+
## When to checkpoint
|
|
28
|
+
|
|
29
|
+
Checkpoint:
|
|
30
|
+
- before the first big search pass
|
|
31
|
+
- before opening a browser-heavy or webpage-heavy reading pass
|
|
32
|
+
- before diving into a new evidence branch
|
|
33
|
+
- after a stable intermediate conclusion
|
|
34
|
+
- before changing investigation direction
|
|
35
|
+
|
|
36
|
+
Example checkpoint names:
|
|
37
|
+
- `incident-search-start`
|
|
38
|
+
- `vendor-review-evidence-branch`
|
|
39
|
+
- `api-timeout-investigation-midpoint`
|
|
40
|
+
|
|
41
|
+
## When to review timeline
|
|
42
|
+
|
|
43
|
+
Run `context_timeline` when:
|
|
44
|
+
- you have followed several leads
|
|
45
|
+
- you are no longer sure what the main anchor is
|
|
46
|
+
- the investigation has already produced multiple checkpoints
|
|
47
|
+
- you are deciding which path should be compacted
|
|
48
|
+
|
|
49
|
+
## When to compact
|
|
50
|
+
|
|
51
|
+
Compact after the investigation produces one of these and there is a continuation that benefits from cleanup:
|
|
52
|
+
- a stable root cause
|
|
53
|
+
- a stable comparison result
|
|
54
|
+
- a dead-end conclusion
|
|
55
|
+
- a shortlist of viable next actions
|
|
56
|
+
- a located data source, old conversation, schema, rule id, query/API pattern, or other fact that unlocks execution
|
|
57
|
+
|
|
58
|
+
If you already have one of these, the investigation phase is usually complete enough to compact. If the next step is to use the finding in another tool call, compact first. If there is no continuation yet because you are about to give the final answer, wait until the next user message before deciding.
|
|
59
|
+
|
|
60
|
+
Do not compact in the middle of a still-open search loop just because the thread feels busy.
|
|
61
|
+
|
|
62
|
+
## Message quality for research compactions
|
|
63
|
+
|
|
64
|
+
Research compactions are especially sensitive to summary quality. The raw exploration may contain details that become important later, but returning to the backup branch is a context switch. Preserve the state needed to use the finding, not the whole journey.
|
|
65
|
+
|
|
66
|
+
Include:
|
|
67
|
+
- **Current task/state:** what the research unlocked and how it will be used next
|
|
68
|
+
- **Finding:** what is now known
|
|
69
|
+
- **Source anchors:** key files, URLs, docs, sessions, commands, queries, or records used to reach the finding
|
|
70
|
+
- **Evidence:** important numbers, errors, examples, IDs, or constraints that support the finding
|
|
71
|
+
- **Rejected leads:** only expensive dead ends that future-you should not repeat
|
|
72
|
+
- **Open questions:** what is still uncertain
|
|
73
|
+
- **Next step:** what to do immediately after compact
|
|
74
|
+
- **Backup pointer:** if `backupCheckpoint` is set, when to return to it
|
|
75
|
+
|
|
76
|
+
Do not compress research to only “found the answer”. That forces future-you to either trust an unsupported conclusion or switch back to the backup for basic details.
|
|
77
|
+
|
|
78
|
+
## Typical rhythm
|
|
79
|
+
|
|
80
|
+
```javascript
|
|
81
|
+
context_checkpoint({ name: "timeout-investigation-start" });
|
|
82
|
+
|
|
83
|
+
// ... search logs, read code, compare docs, inspect outputs ...
|
|
84
|
+
|
|
85
|
+
// Stable finding found and the next action is execution/validation, so compact before continuing.
|
|
86
|
+
context_timeline();
|
|
87
|
+
|
|
88
|
+
context_compact({
|
|
89
|
+
target: "timeout-investigation-start",
|
|
90
|
+
backupCheckpoint: "timeout-investigation-raw-history",
|
|
91
|
+
summary: "Current task: plan mitigation for API timeouts. State: DB connection pool exhaustion is the likely root cause. Evidence: logs show pool wait timeouts during peak traffic; config has pool size 10; no network errors found in the checked logs. Rejected lead: API gateway timeout was downstream of DB waits, not the origin. Backup: timeout-investigation-raw-history if exact log lines are needed. Next step: propose mitigation and validation steps."
|
|
92
|
+
});
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Good compact outcomes
|
|
96
|
+
|
|
97
|
+
After compacting, you should be able to continue with:
|
|
98
|
+
- the finding
|
|
99
|
+
- the recommendation
|
|
100
|
+
- the next verification step
|
|
101
|
+
- the next narrower investigation
|
|
102
|
+
|
|
103
|
+
You should not still need the whole raw trail in active context unless the investigation is still ongoing.
|
package/extensions/dm-context/skills/context-management/references/task-switching-and-cleanup.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Task Switching and Cleanup
|
|
2
|
+
|
|
3
|
+
Use this reference when the main problem is not the task domain itself, but a change in thread state, such as:
|
|
4
|
+
- the user inserts a temporary side task
|
|
5
|
+
- the user starts a new task after a completed noisy task
|
|
6
|
+
- you need to pause one line of work and resume it later
|
|
7
|
+
- several active fronts now exist
|
|
8
|
+
- the thread is already messy and needs cleanup before continuing
|
|
9
|
+
- a finished noisy phase should be summarized and left behind before new work starts
|
|
10
|
+
|
|
11
|
+
This reference is for **pause/resume, cleanup, and clean continuation**. It is not for repeated similar items or plan-driven execution.
|
|
12
|
+
|
|
13
|
+
## Three common variants
|
|
14
|
+
|
|
15
|
+
### Interruption / task switch
|
|
16
|
+
Use when you are actively switching away from one line of work and intend to come back.
|
|
17
|
+
|
|
18
|
+
### Completed-task handoff
|
|
19
|
+
Use when a previous task is complete, the user has started a new task or given an explicit next instruction, and the previous task's raw path is noisy enough that it should not be carried into the new work. A request for review, feedback, or an explanation of the completed work is not this handoff.
|
|
20
|
+
|
|
21
|
+
### Cleanup and continue
|
|
22
|
+
Use when the thread is already stale or messy and you want to compress it now, even though context management is being adopted late.
|
|
23
|
+
|
|
24
|
+
## Working pattern
|
|
25
|
+
|
|
26
|
+
1. Inspect timeline if anchor choice is unclear.
|
|
27
|
+
2. Before switching away or compacting a noisy path, preserve or choose the anchor that will give the resumed/new task a clean working set.
|
|
28
|
+
3. If needed, create a backup checkpoint for the current noisy branch.
|
|
29
|
+
4. If the user has just started a new task after a completed noisy task, compact before doing the new task so the completed task becomes a compact summary rather than active baggage.
|
|
30
|
+
5. If the user asks a concrete side question while noisy mainline work is active, pause or summarize the active work, compact if the raw mainline history is no longer needed for the side question, answer the side question, and preserve how to resume the paused work.
|
|
31
|
+
6. Handle the side task or cleanup move.
|
|
32
|
+
7. Compact away the stale path when the handoff summary is clear.
|
|
33
|
+
8. Resume from the paused anchor or continue from the compacted state.
|
|
34
|
+
|
|
35
|
+
## Useful anchors
|
|
36
|
+
|
|
37
|
+
Example checkpoint names:
|
|
38
|
+
- `primary-task-paused`
|
|
39
|
+
- `migration-mainline-paused`
|
|
40
|
+
- `release-investigation-paused`
|
|
41
|
+
- `cleanup-pre-noise-anchor`
|
|
42
|
+
|
|
43
|
+
## When to review timeline
|
|
44
|
+
|
|
45
|
+
Run `context_timeline` when:
|
|
46
|
+
- multiple interruptions happened
|
|
47
|
+
- the pause lasted many turns
|
|
48
|
+
- several side-task branches now exist
|
|
49
|
+
- you are unsure which anchor gives the resumed/new task the right working set
|
|
50
|
+
- the thread is already messy and you need to find the right pre-noise checkpoint
|
|
51
|
+
|
|
52
|
+
## When to compact
|
|
53
|
+
|
|
54
|
+
Compact when:
|
|
55
|
+
- the interruption created lots of noise
|
|
56
|
+
- the side task is done and should not stay active in full
|
|
57
|
+
- the user begins a new task after a completed noisy task and the previous raw path is no longer useful in full
|
|
58
|
+
- a stale path is making current reasoning worse
|
|
59
|
+
- the useful state is now much smaller than the accumulated process
|
|
60
|
+
- you can express the handoff clearly in a summary
|
|
61
|
+
|
|
62
|
+
Do not compact at the instant you finish a user-visible task if there is no known continuation. In that moment, deliver the answer and wait, retaining the raw trail for review, feedback, or questions about the work. If a later user message starts a new task or establishes an explicit next phase, that is the right time to decide whether compacting the completed task helps before proceeding. If the completed task changed files, browser state, tickets, or remote services, include those side effects in the handoff summary because the context move does not undo them. If the interruption was tiny and clean, a compact may be unnecessary. A checkpoint before switching away is still the key move.
|
|
63
|
+
|
|
64
|
+
## Common mistakes
|
|
65
|
+
|
|
66
|
+
Avoid:
|
|
67
|
+
- switching away without a pause checkpoint
|
|
68
|
+
- compacting immediately after a final answer just because the task completed
|
|
69
|
+
- starting a new, unrelated user task while still carrying the previous task's full raw path
|
|
70
|
+
- returning to the main line while still carrying the side task's full raw path
|
|
71
|
+
- trying to clean up without first checking timeline when anchor choice is unclear
|
|
72
|
+
- resetting past still-valid near-term context without carrying it in the summary
|
|
73
|
+
- forgetting that files and external systems remain in their latest state after context navigation
|
|
@@ -61,7 +61,8 @@ export default function context_default(pi) {
|
|
|
61
61
|
const toolDefTokensRaw = estimateTokens(JSON.stringify(activeToolDefs));
|
|
62
62
|
const totalActual = usage.tokens;
|
|
63
63
|
const limit = usage.contextWindow;
|
|
64
|
-
|
|
64
|
+
const usagePercent = usage.percent;
|
|
65
|
+
if (totalActual == null || limit == null || usagePercent == null) {
|
|
65
66
|
ctx.ui.notify("Context usage info not available.", "warning");
|
|
66
67
|
return;
|
|
67
68
|
}
|
|
@@ -113,7 +114,7 @@ export default function context_default(pi) {
|
|
|
113
114
|
}
|
|
114
115
|
gridLines.push(rowStr.trimEnd());
|
|
115
116
|
}
|
|
116
|
-
const totalUsageTitle = `${theme.fg("text", theme.bold("Total Usage".padEnd(16)))} ${theme.fg("text", theme.bold(formatTokens(totalActual).padStart(7)))} ${theme.fg("text", theme.bold(`(${
|
|
117
|
+
const totalUsageTitle = `${theme.fg("text", theme.bold("Total Usage".padEnd(16)))} ${theme.fg("text", theme.bold(formatTokens(totalActual).padStart(7)))} ${theme.fg("text", theme.bold(`(${usagePercent.toFixed(1).padStart(5)}%)`))}`;
|
|
117
118
|
const catDetailLines = categories.map((cat) => {
|
|
118
119
|
const labelStr = cat.label.padEnd(14);
|
|
119
120
|
const valStr = formatTokens(cat.value).padStart(7);
|