context-mode 0.5.20 → 0.5.23

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.
@@ -25,21 +25,27 @@ description: |
25
25
 
26
26
  ## MANDATORY RULE
27
27
 
28
- **Before using Bash, curl, cat, or any command that produces output, ask yourself:**
28
+ **Default to context-mode for ALL commands. Only use Bash for guaranteed-small-output operations.**
29
29
 
30
- > "Could this output be more than 20 lines?"
30
+ Bash whitelist (safe to run directly):
31
+ - **File mutations**: `mkdir`, `mv`, `cp`, `rm`, `touch`, `chmod`
32
+ - **Git writes**: `git add`, `git commit`, `git push`, `git checkout`, `git branch`, `git merge`
33
+ - **Navigation**: `cd`, `pwd`, `which`
34
+ - **Process control**: `kill`, `pkill`
35
+ - **Package management**: `npm install`, `npm publish`, `pip install`
36
+ - **Simple output**: `echo`, `printf`
31
37
 
32
- If YES or UNCERTAIN use `execute` or `execute_file`. Not Bash. Not curl. Not cat.
38
+ **Everything else → `execute` or `execute_file`.** Any command that reads, queries, fetches, lists, logs, tests, builds, diffs, inspects, or calls an external service. This includes ALL CLIs (gh, aws, kubectl, docker, terraform, wrangler, fly, heroku, gcloud, etc.) there are thousands and we cannot list them all.
33
39
 
34
- **This is not optional.** Every KB of unnecessary context reduces the quality and speed of the entire session.
40
+ **When uncertain, use context-mode.** Every KB of unnecessary context reduces the quality and speed of the entire session.
35
41
 
36
42
  ## Decision Tree
37
43
 
38
44
  ```
39
45
  About to run a command / read a file / call an API?
40
46
 
41
- ├── Output is GUARANTEED small (<20 lines)?
42
- │ └── Use Bash (git status, pwd, ls, echo, etc.)
47
+ ├── Command is on the Bash whitelist (file mutations, git writes, navigation, echo)?
48
+ │ └── Use Bash
43
49
 
44
50
  ├── Output MIGHT be large or you're UNSURE?
45
51
  │ └── Use context-mode execute or execute_file
@@ -142,7 +148,7 @@ Use context-mode for ANY of these, without being asked:
142
148
  2. **Write analysis code, not just data dumps.** Don't `console.log(JSON.stringify(data))` — analyze first, print findings.
143
149
  3. **Be specific in output.** Print bug details with IDs, line numbers, exact values — not just counts.
144
150
  4. **For files you need to EDIT**: Use the normal Read tool. context-mode is for analysis, not editing.
145
- 5. **For tiny outputs (<5 lines guaranteed)**: Use Bash. Don't over-engineer `git status` through context-mode.
151
+ 5. **For Bash whitelist commands only**: Use Bash for file mutations, git writes, navigation, process control, package install, and echo. Everything else goes through context-mode.
146
152
  6. **Never use `index(content: large_data)`.** Use `index(path: ...)` to read files server-side. The `content` parameter sends data through context as a tool parameter — use it only for small inline text.
147
153
  7. **Always use `filename` parameter** on Playwright tools (`browser_snapshot`, `browser_console_messages`, `browser_network_requests`). Without it, the full output enters context.
148
154
  8. **Don't re-index data already in context.** If an MCP tool returned data in a previous response, it's already loaded — use it directly or save to file first.
package/start.sh CHANGED
@@ -1,6 +1,14 @@
1
1
  #!/bin/sh
2
2
  DIR="$(cd "$(dirname "$0")" && pwd)"
3
3
  cd "$DIR"
4
+
5
+ # Bundle exists (CI-built) — start instantly, install native module in background
6
+ if [ -f server.bundle.mjs ]; then
7
+ [ -d node_modules/better-sqlite3 ] || npm install better-sqlite3 --no-package-lock --no-save --silent 2>/dev/null &
8
+ exec node server.bundle.mjs
9
+ fi
10
+
11
+ # Fallback: no bundle (dev or npm install) — full build
4
12
  [ -d node_modules ] || npm install --silent 2>/dev/null
5
13
  [ -f build/server.js ] || npx tsc --silent 2>/dev/null
6
14
  exec node build/server.js