deepflow 0.1.86 → 0.1.87

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepflow",
3
- "version": "0.1.86",
3
+ "version": "0.1.87",
4
4
  "description": "Doing reveals what thinking can't predict — spec-driven iterative development for Claude Code",
5
5
  "keywords": [
6
6
  "claude",
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: df:discover
3
3
  description: Explore a problem space deeply through structured questioning to surface requirements and constraints
4
- allowed-tools: [AskUserQuestion, Read]
4
+ allowed-tools: [AskUserQuestion, Read, Agent]
5
5
  ---
6
6
 
7
7
  # /df:discover — Deep Problem Exploration
@@ -10,9 +10,9 @@ allowed-tools: [AskUserQuestion, Read]
10
10
 
11
11
  You are a Socratic questioner. Your ONLY job is to ask questions that surface hidden requirements, assumptions, and constraints.
12
12
 
13
- **NEVER:** Read source files, use Glob/Grep, spawn agents, create files (except `.deepflow/decisions.md`), run git, use TaskOutput, use Task tool, use EnterPlanMode, use ExitPlanMode
13
+ **NEVER:** Read source files directly, use Glob/Grep directly, proactively spawn agents, create files (except `.deepflow/decisions.md`), run git, use TaskOutput, use Task tool, use EnterPlanMode, use ExitPlanMode
14
14
 
15
- **ONLY:** Ask questions using `AskUserQuestion` tool, respond conversationally
15
+ **ONLY:** Ask questions using `AskUserQuestion` tool, respond conversationally, and spawn context-fetch agents **when the user explicitly requests it**
16
16
 
17
17
  ---
18
18
 
@@ -91,6 +91,46 @@ Example questions:
91
91
  - Keep your responses short between questions — don't lecture
92
92
  - Acknowledge answers briefly before asking the next question
93
93
 
94
+ ### On-Demand Context Fetching
95
+
96
+ When the user explicitly asks you to look at code or a URL (e.g., "olha no código", "vê esse link", "look at src/auth/", "check https://docs.example.com"), fetch context using a sub-agent.
97
+
98
+ **Trigger:** Intent-based detection — the user must explicitly request it. NEVER proactively fetch context.
99
+
100
+ **For codebase context:**
101
+ ```
102
+ Agent(subagent_type="Explore", model="haiku", prompt="""
103
+ Read and summarize the following: {what the user asked to see}
104
+
105
+ Rules:
106
+ - Return ONLY factual observations: what files exist, what functions/types are defined, what patterns are used
107
+ - Do NOT suggest solutions, improvements, or architectural changes
108
+ - Do NOT give opinions on code quality
109
+ - Keep response under 4000 tokens
110
+ - Format: bullet points of facts
111
+ """)
112
+ ```
113
+
114
+ **For URL context:**
115
+ ```
116
+ Agent(subagent_type="Explore", model="haiku", prompt="""
117
+ Use the browse-fetch skill to fetch this URL: {url}
118
+
119
+ Then summarize what the page contains.
120
+
121
+ Rules:
122
+ - Return ONLY factual observations: what the documentation says, what APIs are described, what patterns are shown
123
+ - Do NOT suggest how to use this in the project
124
+ - Do NOT give opinions or recommendations
125
+ - Keep response under 4000 tokens
126
+ - Format: bullet points of facts
127
+ """)
128
+ ```
129
+
130
+ **After receiving context:** Briefly share the factual summary with the user, then **resume Socratic questioning** incorporating the new facts. Do NOT shift to suggesting solutions.
131
+
132
+ **Soft cap:** ~3 context fetches per discover session to protect context window.
133
+
94
134
  ### When the User Wants to Move On
95
135
  When the user signals they want to advance (e.g., "I think that's enough", "let's move on", "ready for next step"):
96
136
 
@@ -125,7 +125,7 @@ Before spawning: `TaskUpdate(taskId: native_id, status: "in_progress")` — acti
125
125
 
126
126
  **Token tracking — record start:**
127
127
  ```
128
- start_percentage = !`cat .deepflow/context.json 2>/dev/null | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('percentage',''))" 2>/dev/null || echo ''`
128
+ start_percentage = !`grep -o '"percentage":[0-9]*' .deepflow/context.json 2>/dev/null | grep -o '[0-9]*' || echo ''`
129
129
  start_timestamp = !`date -u +%Y-%m-%dT%H:%M:%SZ`
130
130
  ```
131
131
  Store both values in memory (keyed by task_id) for use after ratchet completes. Omit if context.json unavailable.
@@ -193,32 +193,24 @@ After ratchet checks complete, truncate command output for context efficiency:
193
193
  After all checks pass, compute and write the token block to `.deepflow/results/T{N}.yaml`:
194
194
 
195
195
  ```
196
- end_percentage = !`cat .deepflow/context.json 2>/dev/null | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('percentage',''))" 2>/dev/null || echo ''`
196
+ end_percentage = !`grep -o '"percentage":[0-9]*' .deepflow/context.json 2>/dev/null | grep -o '[0-9]*' || echo ''`
197
197
  ```
198
198
 
199
199
  Parse `.deepflow/token-history.jsonl` to sum token fields for lines whose `timestamp` falls between `start_timestamp` and `end_timestamp` (ISO 8601 compare):
200
200
  ```bash
201
- python3 - <<'EOF'
202
- import json, sys
203
- from datetime import datetime, timezone
204
-
205
- start = "REPLACE_start_timestamp"
206
- end = "REPLACE_end_timestamp" # current time: date -u +%Y-%m-%dT%H:%M:%SZ
207
-
208
- totals = {"input_tokens": 0, "cache_creation_input_tokens": 0, "cache_read_input_tokens": 0}
209
- try:
210
- with open(".deepflow/token-history.jsonl") as f:
211
- for line in f:
212
- entry = json.loads(line)
213
- ts = entry.get("timestamp", "")
214
- if start <= ts <= end:
215
- for k in totals:
216
- totals[k] += entry.get(k, 0)
217
- except FileNotFoundError:
218
- sys.exit(0)
219
-
220
- print(json.dumps(totals))
221
- EOF
201
+ awk -v start="REPLACE_start_timestamp" -v end="REPLACE_end_timestamp" '
202
+ {
203
+ ts=""; inp=0; cre=0; rd=0
204
+ if (match($0, /"timestamp":"[^"]*"/)) { ts=substr($0, RSTART+13, RLENGTH-14) }
205
+ if (ts >= start && ts <= end) {
206
+ if (match($0, /"input_tokens":[0-9]+/)) inp=substr($0, RSTART+15, RLENGTH-15)
207
+ if (match($0, /"cache_creation_input_tokens":[0-9]+/)) cre=substr($0, RSTART+30, RLENGTH-30)
208
+ if (match($0, /"cache_read_input_tokens":[0-9]+/)) rd=substr($0, RSTART+26, RLENGTH-26)
209
+ si+=inp; sc+=cre; sr+=rd
210
+ }
211
+ }
212
+ END { printf "{\"input_tokens\":%d,\"cache_creation_input_tokens\":%d,\"cache_read_input_tokens\":%d}\n", si+0, sc+0, sr+0 }
213
+ ' .deepflow/token-history.jsonl 2>/dev/null || echo '{}'
222
214
  ```
223
215
 
224
216
  Append (or create) `.deepflow/results/T{N}.yaml` with the following block. Use shell injection to read the existing file first:
@@ -237,7 +229,7 @@ tokens:
237
229
  cache_read_input_tokens: {sum from jsonl}
238
230
  ```
239
231
 
240
- **Omit entirely if:** context.json was unavailable at start OR end, OR token-history.jsonl is missing, OR python3 is unavailable. Never fail the ratchet due to token tracking errors.
232
+ **Omit entirely if:** context.json was unavailable at start OR end, OR token-history.jsonl is missing, OR awk is unavailable. Never fail the ratchet due to token tracking errors.
241
233
 
242
234
  **Evaluate:** All pass + no violations → commit stands. Any failure → attempt partial salvage before reverting:
243
235
 
@@ -5,7 +5,7 @@ description: Update or uninstall deepflow, check installed version
5
5
 
6
6
  # /df:update — Update deepflow
7
7
 
8
- ## Update
8
+ **ACTION REQUIRED:** Immediately run the update command below. Do NOT ask for confirmation — the user already confirmed by running `/df:update`.
9
9
 
10
10
  ```bash
11
11
  npx deepflow@latest
@@ -15,6 +15,8 @@ Auto-detects existing installation and updates it.
15
15
 
16
16
  ## Uninstall
17
17
 
18
+ To uninstall instead, run:
19
+
18
20
  ```bash
19
21
  npx deepflow --uninstall
20
22
  ```