longer-agent 0.1.2 → 0.1.3

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.
Files changed (55) hide show
  1. package/README.md +58 -151
  2. package/README.zh-CN.md +59 -152
  3. package/agent_templates/executor/agent.yaml +1 -0
  4. package/agent_templates/executor/system_prompt.md +1 -1
  5. package/agent_templates/explorer/agent.yaml +1 -0
  6. package/agent_templates/explorer/system_prompt.md +1 -1
  7. package/agent_templates/main/system_prompt.md +3 -2
  8. package/dist/agents/tool-loop.d.ts.map +1 -1
  9. package/dist/agents/tool-loop.js +6 -0
  10. package/dist/agents/tool-loop.js.map +1 -1
  11. package/dist/commands.d.ts.map +1 -1
  12. package/dist/commands.js +0 -1
  13. package/dist/commands.js.map +1 -1
  14. package/dist/log-projection.d.ts.map +1 -1
  15. package/dist/log-projection.js +71 -12
  16. package/dist/log-projection.js.map +1 -1
  17. package/dist/persistence.d.ts +2 -1
  18. package/dist/persistence.d.ts.map +1 -1
  19. package/dist/persistence.js +4 -2
  20. package/dist/persistence.js.map +1 -1
  21. package/dist/session.d.ts +0 -2
  22. package/dist/session.d.ts.map +1 -1
  23. package/dist/session.js +48 -156
  24. package/dist/session.js.map +1 -1
  25. package/dist/templates/loader.d.ts.map +1 -1
  26. package/dist/templates/loader.js +2 -0
  27. package/dist/templates/loader.js.map +1 -1
  28. package/dist/tools/basic.d.ts +2 -2
  29. package/dist/tools/basic.d.ts.map +1 -1
  30. package/dist/tools/basic.js +54 -7
  31. package/dist/tools/basic.js.map +1 -1
  32. package/dist/tools/comm.d.ts.map +1 -1
  33. package/dist/tools/comm.js +8 -7
  34. package/dist/tools/comm.js.map +1 -1
  35. package/dist/tui/app.d.ts.map +1 -1
  36. package/dist/tui/app.js +62 -39
  37. package/dist/tui/app.js.map +1 -1
  38. package/dist/tui/components/input-panel.d.ts.map +1 -1
  39. package/dist/tui/components/input-panel.js +8 -6
  40. package/dist/tui/components/input-panel.js.map +1 -1
  41. package/dist/tui/components/plan-panel.d.ts +3 -1
  42. package/dist/tui/components/plan-panel.d.ts.map +1 -1
  43. package/dist/tui/components/plan-panel.js +15 -2
  44. package/dist/tui/components/plan-panel.js.map +1 -1
  45. package/dist/tui/components/status-bar.d.ts.map +1 -1
  46. package/dist/tui/components/status-bar.js +17 -4
  47. package/dist/tui/components/status-bar.js.map +1 -1
  48. package/dist/tui/status-bar-model-name.d.ts +2 -0
  49. package/dist/tui/status-bar-model-name.d.ts.map +1 -0
  50. package/dist/tui/status-bar-model-name.js +81 -0
  51. package/dist/tui/status-bar-model-name.js.map +1 -0
  52. package/package.json +3 -3
  53. package/prompts/tools/plan.md +11 -240
  54. package/prompts/tools/summarize_context.md +1 -1
  55. package/prompts/tools/time.md +6 -0
@@ -1,252 +1,23 @@
1
1
  ## `plan`
2
2
 
3
- Use a tracked plan for non-trivial work.
4
-
5
- A plan is a live execution guide. You do not need to fully design the whole task up front. Instead, first identify the overall route, then refine and execute one checkpoint at a time.
6
-
7
- ### When to use a plan
8
-
9
- Use `plan` when the task is more than a quick obvious change.
10
-
11
- Typical cases:
12
-
13
- - The task spans multiple files, modules, or phases
14
- - The implementation path is not fully obvious yet
15
- - You should first find existing patterns or reusable code
16
- - The work benefits from staged validation
17
- - The task may benefit from `explorer` sub-agents
18
- - The task has roughly 3 or more meaningful checkpoints
19
-
20
- Skip the plan only for small, local, low-uncertainty tasks that can be completed quickly.
21
-
22
- ### Core workflow
23
-
24
- Follow this workflow:
25
-
26
- 1. Do a light initial exploration
27
- 2. Write a high-level plan
28
- 3. Then repeat for each checkpoint:
29
- - Explore the checkpoint if needed
30
- - Update its sub-steps if the route is clearer
31
- - Execute and validate it
32
- - Call `show_context`, then either dismiss annotations or summarize completed context
33
- - Mark the checkpoint complete and move on
34
-
35
- This is a rolling planning workflow.
36
-
37
- Do **not** fully audit the codebase before starting.
38
- Do **not** try to write a detailed implementation spec for every checkpoint up front.
39
-
40
- Instead:
41
-
42
- - Explore the whole task just enough to identify the likely route
43
- - Explore each checkpoint more deeply only when you are about to do it
44
-
45
- ### Initial exploration
46
-
47
- Your first exploration pass should be light.
48
-
49
- Its purpose is to answer:
50
-
51
- - What is the likely implementation route?
52
- - Which files or modules are likely to matter?
53
- - What existing code should probably be reused or mirrored?
54
- - How will the result be validated?
55
-
56
- Once those answers are mostly clear, write the plan and begin.
57
-
58
- Do not stay in exploration mode longer than necessary.
59
-
60
- ### Checkpoint-level exploration
61
-
62
- Before starting a checkpoint, explore that checkpoint's implementation path if it is not already clear.
63
-
64
- This exploration should be narrow and practical.
65
-
66
- Examples:
67
-
68
- - Read the exact files you expect to change
69
- - Find similar implementations to copy or adapt
70
- - Trace the local call flow for this checkpoint
71
- - Check how nearby tests are written
72
- - Confirm what validation command applies to this checkpoint
73
-
74
- If the checkpoint is already clear, skip extra exploration and execute it directly.
75
-
76
- ### Using explorers
77
-
78
- Use `explorer` sub-agents when they help you understand the code faster.
79
-
80
- Good uses:
81
-
82
- - The task touches multiple code areas
83
- - You want to find similar implementations in parallel
84
- - You want one agent to inspect implementation patterns and another to inspect tests
85
- - You want to narrow down the right integration point before editing
86
-
87
- Guidelines:
88
-
89
- - Prefer the fewest explorers necessary
90
- - 1 explorer is usually enough
91
- - Use 2-3 only when the task naturally splits into distinct areas
92
- - Give each explorer a specific search goal
93
- - Do not use explorers for trivial lookups in known files
94
-
95
- Use explorers to support the current checkpoint, not to perform a full codebase audit.
3
+ Always create a plan for multi-step work. Skip the plan only for quick, single-step changes.
96
4
 
97
5
  ### Creating a plan
98
6
 
99
- Write a `.md` plan file in `{SESSION_ARTIFACTS}`.
100
-
101
- The file must begin with a `## Checkpoints` section.
102
-
103
- The checkpoints under that header must use Markdown task checkboxes in this exact structure:
104
-
105
- - Incomplete checkpoint: `- [ ] ...`
106
- - Completed checkpoint: `- [x] ...`
107
-
108
- Do not use numbered lists for checkpoints. Do not replace the checkboxes with another format. The progress panel reads this checkbox structure directly.
109
-
110
- Recommended structure:
111
-
112
- ```markdown
113
- ## Checkpoints
114
- - [ ] Explore the auth flow and define the implementation route
115
- - [ ] Implement refresh-token expiration handling
116
- - [ ] Add tests and validate behavior
117
-
118
- ## Context
119
- We need to handle expired refresh tokens without falling back to the hardcoded viewer role.
120
- Expected outcome: expired refresh tokens trigger the existing re-auth path and preserve other auth behavior.
7
+ Pass your checkpoints directly:
121
8
 
122
- ## Key Files
123
- - `src/auth/provider.ts`
124
- - `src/auth/errors.ts`
125
- - `src/auth/guard.ts`
126
- - `tests/auth-provider.test.ts`
127
-
128
- ## Explore the auth flow and define the implementation route
129
- 1. Read `src/auth/provider.ts` and trace refresh token failure handling
130
- 2. Inspect `src/auth/guard.ts` to find current fallback behavior
131
- 3. Find an existing auth error propagation pattern to reuse
132
- 4. Update the next checkpoint with concrete implementation steps
133
-
134
- ## Implement refresh-token expiration handling
135
- 1. Confirm where the expiration error is detected
136
- 2. Add or reuse a specific error type if needed
137
- 3. Route expired refresh token failures into the existing re-auth flow
138
- 4. Verify no unrelated auth failures change behavior
139
-
140
- ## Add tests and validate behavior
141
- 1. Add focused test coverage for expired refresh tokens
142
- 2. Update nearby guard tests if behavior changed
143
- 3. Run focused auth tests
144
- 4. Do a manual smoke test if applicable
145
-
146
- ## Validation
147
- - Run focused auth tests
148
- - Verify expired refresh tokens trigger re-auth
149
- - Verify other auth failures behave as before
9
+ ```
10
+ plan(action="submit", checkpoints=["Explore the auth flow", "Implement the fix", "Add tests"])
150
11
  ```
151
12
 
152
- ### Checkpoint quality
153
-
154
- Checkpoints should represent meaningful outcomes.
155
-
156
- Good checkpoints:
157
-
158
- - Explore the request pipeline and identify the integration point
159
- - Implement retry behavior for failed uploads
160
- - Add regression tests and validate the flow
161
-
162
- Weak checkpoints:
163
-
164
- - Read code
165
- - Think
166
- - Edit file
167
- - Run command
168
-
169
- Each checkpoint should produce a visible result or verified milestone.
170
-
171
- ### Context handling after each checkpoint
172
-
173
- After each meaningful checkpoint, call `show_context`.
174
-
175
- Use it to inspect the current active window's context distribution before deciding what to do next.
176
-
177
- Then choose one of these paths:
178
-
179
- #### Path A: keep the current context as-is
180
-
181
- Use this when:
182
-
183
- - The context is not too large
184
- - The material is still highly valuable in raw form
185
- - You expect to refer back to the exact details in the next checkpoint
186
-
187
- In this case:
188
-
189
- - Call `show_context(dismiss=true)` to hide the inline annotations
190
- - Continue to the next checkpoint
191
-
192
- #### Path B: summarize completed context
193
-
194
- Use this when:
195
-
196
- - A checkpoint is complete and its raw exploration or tool output is no longer needed in full
197
- - The important conclusions are stable
198
- - A compact summary can preserve what matters better than keeping all raw detail
199
-
200
- In this case:
201
-
202
- 1. Use the `show_context` output to identify the relevant context groups
203
- 2. Write a summary that preserves what future checkpoints will actually need
204
- 3. Call `summarize_context`
205
- 4. Continue to the next checkpoint
206
-
207
- Do **not** try to guess context pressure abstractly. Use `show_context` to make the decision based on the actual context map.
208
-
209
- ### Summarizing well
210
-
211
- The goal of summarization is not to make things shorter. The goal is to preserve the right information and let go of raw detail that has served its purpose.
212
-
213
- A good summary usually keeps:
214
-
215
- - Architectural findings that later checkpoints depend on
216
- - Decisions and why they were made
217
- - Relevant file paths and functions
218
- - Important edge cases
219
- - Exact snippets only when they will be needed again
220
-
221
- A good summary usually drops:
222
-
223
- - Search process
224
- - Dead ends that no longer matter
225
- - Redundant tool output
226
- - Raw logs whose conclusions are already understood
227
-
228
- ### Updating the plan
229
-
230
- The plan is live. Update it when reality changes.
231
-
232
- Revise it when:
233
-
234
- - Exploration changes your implementation route
235
- - You find a better reuse point
236
- - A checkpoint needs to be split or reordered
237
- - Validation reveals missing follow-up work
238
- - The scope changes materially
239
-
240
- Do not keep following an outdated plan.
241
-
242
- ### Asking the user
13
+ Checkpoints represent meaningful milestones, not individual actions. Good: "Implement retry logic for failed uploads". Weak: "Edit file", "Read code", "Run tests".
243
14
 
244
- Use `ask` only when a concrete user decision is needed and cannot be discovered from the codebase or request. Good cases include choosing between a small number of real implementation options, confirming a product behavior tradeoff, or resolving ambiguity that materially changes the plan. Do not ask the user questions you can answer through exploration.
15
+ You don't need to design everything upfront. Start with a high-level plan and refine as you go.
245
16
 
246
- ### Submitting and executing
17
+ ### Tracking progress
247
18
 
248
- - `plan(action="submit", file="plan.md")` - Activates the plan. A progress panel appears above the conversation showing your checkpoints.
249
- - `plan(action="check", item=0)` - Marks checkpoint 0 as done (0-based index). The system updates the checkbox in the file and refreshes the panel.
250
- - `plan(action="finish")` - Dismisses the panel when all work is complete.
19
+ - `plan(action="submit", checkpoints=[...])` Activate the plan. A progress panel appears above the conversation.
20
+ - `plan(action="check", item=N)` Mark checkpoint N as complete (1-based). When the last checkpoint is checked, the plan closes automatically.
21
+ - `plan(action="dismiss")` Abandon the plan if the direction changes.
251
22
 
252
- The plan file is injected into your context every round. Keep it current. You can edit it freely at any time with `edit_file`.
23
+ **Check off each checkpoint as you complete it.** The progress panel is the user's primary view of where you are. An unchecked completed checkpoint looks like stalled work always call `check` before moving on.
@@ -105,7 +105,7 @@ Preserves the decision and reasoning; drops the exploration steps, Redis config
105
105
 
106
106
  **Example D — Summarizing within a plan workflow:**
107
107
 
108
- You're executing a plan. The "Explore the caching layer" checkpoint is done, and you've written detailed implementation sub-steps into the plan file. The next checkpoint is "Implement LRU cache". The raw exploration (file reads, greps, dead ends) is no longer needed — the actionable knowledge is captured in the plan's sub-steps.
108
+ You're executing a plan. The "Explore the caching layer" checkpoint is done. The next checkpoint is "Implement LRU cache". The raw exploration (file reads, greps, dead ends) is no longer needed — the actionable knowledge is captured in the summary below.
109
109
 
110
110
  > Exploration of caching layer:
111
111
  > - Current cache: naive Map in `src/cache/store.ts`, no eviction, no TTL. Grows unbounded.
@@ -0,0 +1,6 @@
1
+ # Tool: time
2
+
3
+ Use `time` when a task depends on the current date/time or timezone.
4
+
5
+ - Call with `{}`.
6
+ - Prefer reporting absolute timestamps (not only relative words like "today"/"now").