返回 JoyAI-Echo
examples.md
1 # My Tool — Practical Examples
2
3 Concrete scenarios showing when and how to use the my tool effectively.
4
5 ## Diagnosis
6
7 ### "Why can't you search the web?"
8 ```
9 → my(action="check", key="web_config.enable")
10 → False
11 → "Web search is disabled. Add web.enable: true to your config to enable it."
12 ```
13
14 ### "Why did you stop?"
15 ```
16 → my(action="check", key="max_iterations")
17 → 40
18 → my(action="check", key="_last_usage")
19 → {"prompt_tokens": 62000, "completion_tokens": 3000}
20 → "I hit the iteration limit (40). The task was complex. I can ask the user if they want to increase it."
21 ```
22
23 ### "What model are you running?"
24 ```
25 → my(action="check", key="model")
26 → 'anthropic/claude-sonnet-4-20250514'
27 ```
28
29 ## Adaptive Behavior
30
31 ### Large codebase analysis
32 ```
33 → my(action="check")
34 → context_window_tokens: 65536
35 → my(action="set", key="context_window_tokens", value=131072)
36 → "Set context_window_tokens = 131072 (was 65536)"
37 → "I've expanded my context window to handle this large codebase."
38 ```
39
40 ### Switching to a faster model for repetitive tasks
41 ```
42 → my(action="set", key="model", value="anthropic/claude-haiku-4-5-20251001")
43 → "Set model = 'anthropic/claude-haiku-4-5-20251001' (was 'anthropic/claude-sonnet-4-20250514')"
44 → "Switched to a faster model for these batch tasks."
45 ```
46
47 ## Cross-Turn Memory
48
49 ### Remembering user preferences
50 ```
51 # Turn 1: user says "keep it brief"
52 → my(action="set", key="user_style", value="concise")
53 → "Set scratchpad.user_style = 'concise'"
54
55 # Turn 3: new topic
56 → my(action="check", key="user_style")
57 → 'concise'
58 (adjusts response style accordingly)
59 ```
60
61 ### Tracking project context
62 ```
63 → my(action="set", key="active_branch", value="feat/auth")
64 → my(action="set", key="test_framework", value="pytest")
65 → my(action="set", key="has_docker", value=true)
66 ```
67
68 ## Budget Awareness
69
70 ### Token-conscious behavior
71 ```
72 → my(action="check", key="_last_usage")
73 → {"prompt_tokens": 58000, "completion_tokens": 12000}
74 → "I've consumed ~70k tokens. I'll keep my remaining responses focused."
75 ```
76
76 lines MARKDOWN