rogermt commited on
Commit
839739a
·
verified ·
1 Parent(s): 6de61ea

Update SKILLS/kilo_agent/references/howto.md

Browse files
Files changed (1) hide show
  1. SKILLS/kilo_agent/references/howto.md +53 -47
SKILLS/kilo_agent/references/howto.md CHANGED
@@ -1,69 +1,75 @@
1
  # Kilo Agent — How To
2
 
3
  Purpose
4
- - Use Kilo (headless DeepSeek CLI) as the reasoning engine for ARC-AGI tasks.
5
- - Kilo identifies transforms, shapes, and parameters from rendered ARC grid images.
6
- - Output is structured markdown that feeds into the NN executor.
7
 
8
- ## Setup
9
 
10
- ```bash
11
- # Install Kilo CLI (if not already)
12
- # See: https://kilo.org/docs/install
13
 
14
- # Verify
15
- kilo --version
16
- ```
17
 
18
- ## Usage Patterns
19
 
20
- ### 1. Direct CLI (headless, free tier)
21
- ```bash
22
- kilo run "Analyze this ARC-AGI task image. Identify the transformation rule." \
23
- --image task_007bbfb7.png \
24
- --format default
25
- ```
26
 
27
- ### 2. Via SDK / tunnel (Kaggle local server)
28
- ```python
29
- from kilo_sdk import KiloClient
30
 
31
- client = KiloClient(server_url="http://localhost:8765") # tunneled
32
- response = client.run(
33
- prompt="Analyze this ARC-AGI task. Output transform name and parameters.",
34
- image="task_007bbfb7.png",
35
- format="default"
36
- )
37
- ```
38
 
39
- ### 3. Structured Output Format
 
 
 
 
40
 
41
- Kilo should output:
 
 
42
 
 
 
 
 
 
 
 
43
  ```markdown
44
- ## Transform
45
- name: kron_self_similar
46
 
47
- ## Parameters
48
- - scale: 3
49
- - input_shape: [3, 3]
50
- - output_shape: [9, 9]
 
51
 
52
- ## Objects
53
- - object_1: {shape: "square", color: 4, position: [0, 0], size: [3, 3]}
54
- ```
55
 
56
- The NN executor parses this markdown to configure the transform.
57
 
58
- ## Verification
 
 
 
 
 
 
59
 
60
- ```bash
61
- # Test that Kilo can see and analyze an ARC task
62
- python SKILLS/kilo_agent/references/examples/test_kilo_arc.py
 
 
 
 
63
  ```
64
 
65
- ## Notes
66
 
67
- - Free tier has latency (~10-60s per request). Batch tasks for overnight runs.
68
- - Headless mode (`kilo run`) is faster than API — no HTTP overhead.
69
- - Image rendering: use `SKILLS/arc_agi_project/references/examples/minimal_runner.py` color scheme.
 
1
  # Kilo Agent — How To
2
 
3
  Purpose
4
+ - Use Kilo (headless CLI) as the reasoning engine .
5
+ Attach to a local kilo server using Python by making HTTP requests to the server's API endpoints.
 
6
 
7
+ see SKILLS/kilo_agent/references/kilo_client.py
8
 
9
+ ### Key Points
 
 
10
 
11
+ 1. **Server Startup**: Uses the same `bun dev serve --port 0` command as the CLI attach command [1](#6-0)
 
 
12
 
13
+ 2. **Authentication**: Implements basic auth using the `KILO_SERVER_PASSWORD` environment variable [2](#6-1)
14
 
15
+ 3. **Directory Context**: Sets the `x-kilo-directory` header to specify the working directory [3](#6-2)
 
 
 
 
 
16
 
17
+ 4. **API Endpoints**: Uses the same HTTP API that the JavaScript SDK uses [4](#6-3)
 
 
18
 
19
+ ### Alternative: Using OpenAI SDK for Local Server
20
+
21
+ If your local server is configured to use the Kilo Gateway, you can also use the OpenAI SDK approach shown previously, just pointing to your local server URL instead of the cloud gateway.
22
+
23
+ ## Notes
24
+
25
+ The Python implementation follows the same pattern as the VS Code extension - it spawns a server and communicates via HTTP + SSE [4](#6-3) . The main difference is using Python's `requests` library instead of the JavaScript SDK.
26
 
27
+ For production use, consider:
28
+ - Adding proper error handling and reconnection logic
29
+ - Implementing the full SSE protocol for real-time updates
30
+ - Using async/await with `aiohttp` for better performance
31
+ - Adding session persistence and recovery
32
 
33
+ Wiki pages you might want to explore:
34
+ - [JavaScript SDK (Kilo-Org/kilocode)](/wiki/Kilo-Org/kilocode#13.2)
35
+ - [SDKs & Frameworks (Kilo-Org/kilocode)](/wiki/Kilo-Org/kilocode#17.1)
36
 
37
+ Wiki pages you might want to explore:
38
+ - [JavaScript SDK (Kilo-Org/kilocode)](/wiki/Kilo-Org/kilocode#13.2)
39
+ - [Console and Dashboard (Kilo-Org/kilocode)](/wiki/Kilo-Org/kilocode#17.2)
40
+
41
+ ### Citations
42
+
43
+ **File:** TESTING.md (L33-42)
44
  ```markdown
45
+ ## 2. `kilo serve` vs `bun dev serve` — important
 
46
 
47
+ | Command | What it runs |
48
+ |---|---|
49
+ | `kilo serve` | The npm-installed production CLI on `$PATH`. **Not the code in this repo.** |
50
+ | `bun dev serve …` (repo root) | The local main-branch backend from this worktree. **This is what you want.** |
51
+ | `bun run --cwd packages/opencode --conditions=browser src/index.ts serve …` | Same as `bun dev serve`, fully expanded. |
52
 
53
+ Root `package.json` defines `"dev"` as the full `bun run --cwd packages/opencode --conditions=browser src/index.ts` invocation, so `bun dev <args>` forwards `<args>` to the local CLI entry point (`packages/opencode/src/index.ts`) without touching the installed binary.
 
 
54
 
55
+ ```
56
 
57
+ **File:** packages/opencode/src/cli/cmd/tui/attach.ts (L21-24)
58
+ ```typescript
59
+ .option("dir", {
60
+ type: "string",
61
+ description: "directory to run in",
62
+ })
63
+ ```
64
 
65
+ **File:** packages/opencode/src/cli/cmd/tui/attach.ts (L43-47)
66
+ ```typescript
67
+ .option("password", {
68
+ alias: ["p"],
69
+ type: "string",
70
+ describe: "basic auth password (defaults to KILO_SERVER_PASSWORD)",
71
+ }),
72
  ```
73
 
 
74
 
75
+ ```