lcode-cli 0.9.0__tar.gz → 0.11.0__tar.gz
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.
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/CHANGELOG.md +41 -1
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/PKG-INFO +10 -5
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/README.md +7 -4
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/docs/agents.md +3 -1
- lcode_cli-0.11.0/docs/commands.md +131 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/docs/configuration.md +3 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/docs/how-it-works.md +3 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/docs/mcp.md +49 -1
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/docs/quickstart.md +1 -1
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/docs/usage.md +5 -0
- lcode_cli-0.11.0/examples/README.md +17 -0
- lcode_cli-0.11.0/examples/commands/review.md +15 -0
- lcode_cli-0.11.0/examples/skills/commit-message/SKILL.md +17 -0
- lcode_cli-0.11.0/examples/skills/commit-message/scripts/staged.sh +8 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/mkdocs.yml +1 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/pyproject.toml +6 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/__init__.py +1 -1
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/agent.py +25 -3
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/cli.py +19 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/config.py +6 -0
- lcode_cli-0.11.0/src/lcode/extensions.py +405 -0
- lcode_cli-0.11.0/src/lcode/frontmatter.py +62 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/mcp/catalog.py +4 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/mcp/catalog.toml +57 -1
- lcode_cli-0.11.0/src/lcode/mcp/server.py +152 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/memory.py +1 -13
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/planning.py +1 -1
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/repl.py +62 -2
- lcode_cli-0.11.0/src/lcode/servers/__init__.py +1 -0
- lcode_cli-0.11.0/src/lcode/servers/encord.py +285 -0
- lcode_cli-0.11.0/src/lcode/servers/valohai.py +329 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/subagents.py +7 -7
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/tools.py +19 -5
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/tests/conftest.py +8 -1
- lcode_cli-0.11.0/tests/test_extensions.py +253 -0
- lcode_cli-0.11.0/tests/test_servers.py +379 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/uv.lock +452 -2
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/.editorconfig +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/.github/CODEOWNERS +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/.github/ISSUE_TEMPLATE/model_request.yml +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/.github/dependabot.yml +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/.github/workflows/ci.yml +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/.github/workflows/docs.yml +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/.github/workflows/release.yml +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/.gitignore +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/.pre-commit-config.yaml +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/AGENTS.md +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/CODE_OF_CONDUCT.md +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/CONTRIBUTING.md +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/LICENSE +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/SECURITY.md +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/docs/assets/demo.svg +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/docs/assets/extra.css +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/docs/assets/logo.svg +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/docs/assets/social-preview.png +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/docs/bench.md +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/docs/changelog.md +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/docs/contributing.md +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/docs/index.md +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/docs/installation.md +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/docs/memory.md +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/docs/models.md +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/docs/sandbox.md +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/docs/troubleshooting.md +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/install.sh +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/overrides/main.html +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/scripts/record_demo.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/scripts/social-preview.html +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/__main__.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/bench.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/catalog.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/checkpoints.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/hardware.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/limits.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/mcp/__init__.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/mcp/auth.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/mcp/client.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/mcp/commands.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/mcp/config.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/mcp/http.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/mcp/manager.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/mcp/protocol.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/mcp/stdio.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/models.toml +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/ollama.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/permissions.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/render.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/sandbox.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/sessions.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/vision.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/src/lcode/web.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/tests/fake_mcp_server.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/tests/test_agent.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/tests/test_bench.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/tests/test_catalog.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/tests/test_checkpoints.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/tests/test_cli.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/tests/test_config.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/tests/test_context_picker.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/tests/test_mcp.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/tests/test_memory.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/tests/test_permissions.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/tests/test_plan_mode.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/tests/test_sandbox.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/tests/test_sessions.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/tests/test_subagents.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/tests/test_tools.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/tests/test_vision.py +0 -0
- {lcode_cli-0.9.0 → lcode_cli-0.11.0}/tests/test_web.py +0 -0
|
@@ -6,6 +6,44 @@ All notable changes to lcode are documented here. The format follows
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.11.0] - 2026-10-05
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Ready-made MCP servers for data and ML platforms:
|
|
14
|
+
- `lcode mcp add metabase` connects to the MCP server built into Metabase 60 and later, with browser
|
|
15
|
+
sign-in, so the model sees your data with your Metabase permissions.
|
|
16
|
+
- `lcode mcp add encord` and `lcode mcp add valohai`: those platforms have no MCP server of their own,
|
|
17
|
+
so lcode now ships `lcode-mcp-encord` (projects, datasets, ontologies, labeling progress, tasks and
|
|
18
|
+
labels, built on the Encord SDK) and `lcode-mcp-valohai` (executions with their logs, metrics and
|
|
19
|
+
outputs, pipelines). Both are read-only unless started with `--allow-writes`, which adds
|
|
20
|
+
assigning tasks and setting priorities (Encord) or starting and stopping executions (Valohai), and
|
|
21
|
+
both work with other MCP clients too. See [MCP servers](https://nasser1941.github.io/lcode/mcp/#encord).
|
|
22
|
+
- Catalog questions that ask for an address now accept it without `https://`.
|
|
23
|
+
|
|
24
|
+
## [0.10.0] - 2026-10-05
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
- Custom commands: prompt templates in `.lcode/commands/<name>.md` or
|
|
29
|
+
`~/.config/lcode/commands/`, run as `/name args`, with `$ARGUMENTS` and `$1`…`$9`, and an
|
|
30
|
+
optional frontmatter for the description, an argument hint and the tools allowed for the
|
|
31
|
+
request.
|
|
32
|
+
- Skills in the [Agent Skills](https://agentskills.io) format, from `.lcode/skills/`,
|
|
33
|
+
`.agents/skills/` and `.claude/skills/` (in the repository and in your home folder). Only their
|
|
34
|
+
names and descriptions are in the system prompt; the model loads a skill's instructions with the
|
|
35
|
+
new `skill` tool when a task matches, and its scripts and reference files when the instructions
|
|
36
|
+
call for them. `/name` starts a skill yourself. `/help` lists commands and skills and where each
|
|
37
|
+
comes from. The `skills` setting limits them to lcode's own folders (`lcode`) or turns them off.
|
|
38
|
+
An example command and skill are in `examples/`. See
|
|
39
|
+
[Commands and skills](https://nasser1941.github.io/lcode/commands/).
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
|
|
43
|
+
- A repository's own commands, skills and agents are used only after you approve them; lcode asks
|
|
44
|
+
the first time and again when they change, like a project's `.mcp.json`. Custom agents from a
|
|
45
|
+
repository (new in 0.8.0) used to load without asking.
|
|
46
|
+
|
|
9
47
|
## [0.9.0] - 2026-10-05
|
|
10
48
|
|
|
11
49
|
### Added
|
|
@@ -264,7 +302,9 @@ First public release.
|
|
|
264
302
|
- `AGENTS.md` project instructions and `/init` to generate them.
|
|
265
303
|
- One-line installer for Linux and macOS.
|
|
266
304
|
|
|
267
|
-
[Unreleased]: https://github.com/nasser1941/lcode/compare/v0.
|
|
305
|
+
[Unreleased]: https://github.com/nasser1941/lcode/compare/v0.11.0...HEAD
|
|
306
|
+
[0.11.0]: https://github.com/nasser1941/lcode/compare/v0.10.0...v0.11.0
|
|
307
|
+
[0.10.0]: https://github.com/nasser1941/lcode/compare/v0.9.0...v0.10.0
|
|
268
308
|
[0.9.0]: https://github.com/nasser1941/lcode/compare/v0.8.0...v0.9.0
|
|
269
309
|
[0.8.0]: https://github.com/nasser1941/lcode/compare/v0.7.0...v0.8.0
|
|
270
310
|
[0.7.0]: https://github.com/nasser1941/lcode/compare/v0.6.1...v0.7.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: lcode-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.11.0
|
|
4
4
|
Summary: A local-first terminal coding agent powered by open-weight models on your own GPU or Mac, via Ollama.
|
|
5
5
|
Project-URL: Homepage, https://nasser1941.github.io/lcode/
|
|
6
6
|
Project-URL: Documentation, https://nasser1941.github.io/lcode/
|
|
@@ -30,6 +30,8 @@ Requires-Dist: prompt-toolkit>=3.0.43
|
|
|
30
30
|
Requires-Dist: requests>=2.31
|
|
31
31
|
Requires-Dist: rich>=13.7
|
|
32
32
|
Requires-Dist: tomli>=2.0; python_version < '3.11'
|
|
33
|
+
Provides-Extra: encord
|
|
34
|
+
Requires-Dist: encord>=0.1.200; extra == 'encord'
|
|
33
35
|
Description-Content-Type: text/markdown
|
|
34
36
|
|
|
35
37
|
<p align="center">
|
|
@@ -80,6 +82,8 @@ through [Ollama](https://ollama.com), and when it needs current information it c
|
|
|
80
82
|
your approval. `auto-edit` and `yolo` modes when you want speed.
|
|
81
83
|
- **Sandbox (optional).** `lcode --sandbox` runs the model's shell commands in a container (Docker or
|
|
82
84
|
Podman) that only sees your project, without network access unless you allow it.
|
|
85
|
+
- **Commands and skills.** Your own `/commands` as prompt templates, and skills in the
|
|
86
|
+
[Agent Skills](https://agentskills.io) format that the model loads only when a task needs them.
|
|
83
87
|
- **Plan mode.** `/plan <request>` or Shift+Tab: the model explores read-only and presents a plan;
|
|
84
88
|
you approve, edit or send it back before anything changes.
|
|
85
89
|
- **Undo.** lcode saves a checkpoint before the model changes files; `/undo` takes back the last
|
|
@@ -93,7 +97,7 @@ through [Ollama](https://ollama.com), and when it needs current information it c
|
|
|
93
97
|
- **Bring your own model.** Eight curated open-weight models, all tested end to end, or any Ollama model
|
|
94
98
|
with tool calling.
|
|
95
99
|
- **MCP servers, ready to go.** Connect Jira and Confluence, GitHub, AWS, Google Drive, Grafana,
|
|
96
|
-
Google Cloud, Sentry, Linear, Notion, Postgres, Kubernetes and more with one command
|
|
100
|
+
Google Cloud, Sentry, Linear, Notion, Postgres, Kubernetes, Metabase, Encord, Valohai and more with one command
|
|
97
101
|
(`lcode mcp add atlassian`), image generation with ComfyUI, or any other MCP server. Browser sign-in (OAuth) is built in.
|
|
98
102
|
- **Sees images.** Attach a screenshot or mockup with `@path` and lcode looks at it, using the
|
|
99
103
|
vision part of your model. With ComfyUI (`lcode mcp add comfyui`) it can also generate and edit
|
|
@@ -197,9 +201,10 @@ fills up. Details: [How it works](https://nasser1941.github.io/lcode/how-it-work
|
|
|
197
201
|
|
|
198
202
|
See the pinned [Roadmap issue](https://github.com/nasser1941/lcode/issues/10). Next up:
|
|
199
203
|
|
|
200
|
-
- [
|
|
201
|
-
- [
|
|
202
|
-
-
|
|
204
|
+
- [Smarter context for small windows](https://github.com/nasser1941/lcode/issues/46)
|
|
205
|
+
- [Code intelligence with language servers](https://github.com/nasser1941/lcode/issues/44)
|
|
206
|
+
- [A repository map and semantic search with local embeddings](https://github.com/nasser1941/lcode/issues/45)
|
|
207
|
+
- [Hooks and permission rules](https://github.com/nasser1941/lcode/issues/43)
|
|
203
208
|
- More models in the catalog, and test reports from your hardware ([report one](https://github.com/nasser1941/lcode/issues/new?template=model_request.yml))
|
|
204
209
|
|
|
205
210
|
## Contributing
|
|
@@ -46,6 +46,8 @@ through [Ollama](https://ollama.com), and when it needs current information it c
|
|
|
46
46
|
your approval. `auto-edit` and `yolo` modes when you want speed.
|
|
47
47
|
- **Sandbox (optional).** `lcode --sandbox` runs the model's shell commands in a container (Docker or
|
|
48
48
|
Podman) that only sees your project, without network access unless you allow it.
|
|
49
|
+
- **Commands and skills.** Your own `/commands` as prompt templates, and skills in the
|
|
50
|
+
[Agent Skills](https://agentskills.io) format that the model loads only when a task needs them.
|
|
49
51
|
- **Plan mode.** `/plan <request>` or Shift+Tab: the model explores read-only and presents a plan;
|
|
50
52
|
you approve, edit or send it back before anything changes.
|
|
51
53
|
- **Undo.** lcode saves a checkpoint before the model changes files; `/undo` takes back the last
|
|
@@ -59,7 +61,7 @@ through [Ollama](https://ollama.com), and when it needs current information it c
|
|
|
59
61
|
- **Bring your own model.** Eight curated open-weight models, all tested end to end, or any Ollama model
|
|
60
62
|
with tool calling.
|
|
61
63
|
- **MCP servers, ready to go.** Connect Jira and Confluence, GitHub, AWS, Google Drive, Grafana,
|
|
62
|
-
Google Cloud, Sentry, Linear, Notion, Postgres, Kubernetes and more with one command
|
|
64
|
+
Google Cloud, Sentry, Linear, Notion, Postgres, Kubernetes, Metabase, Encord, Valohai and more with one command
|
|
63
65
|
(`lcode mcp add atlassian`), image generation with ComfyUI, or any other MCP server. Browser sign-in (OAuth) is built in.
|
|
64
66
|
- **Sees images.** Attach a screenshot or mockup with `@path` and lcode looks at it, using the
|
|
65
67
|
vision part of your model. With ComfyUI (`lcode mcp add comfyui`) it can also generate and edit
|
|
@@ -163,9 +165,10 @@ fills up. Details: [How it works](https://nasser1941.github.io/lcode/how-it-work
|
|
|
163
165
|
|
|
164
166
|
See the pinned [Roadmap issue](https://github.com/nasser1941/lcode/issues/10). Next up:
|
|
165
167
|
|
|
166
|
-
- [
|
|
167
|
-
- [
|
|
168
|
-
-
|
|
168
|
+
- [Smarter context for small windows](https://github.com/nasser1941/lcode/issues/46)
|
|
169
|
+
- [Code intelligence with language servers](https://github.com/nasser1941/lcode/issues/44)
|
|
170
|
+
- [A repository map and semantic search with local embeddings](https://github.com/nasser1941/lcode/issues/45)
|
|
171
|
+
- [Hooks and permission rules](https://github.com/nasser1941/lcode/issues/43)
|
|
169
172
|
- More models in the catalog, and test reports from your hardware ([report one](https://github.com/nasser1941/lcode/issues/new?template=model_request.yml))
|
|
170
173
|
|
|
171
174
|
## Contributing
|
|
@@ -134,7 +134,9 @@ Report bugs first, with `path:line`, then missing tests, then style. Don't fix a
|
|
|
134
134
|
| `~/.config/lcode/agents/<name>.md` | For every repository |
|
|
135
135
|
|
|
136
136
|
The file name is the agent's name. A repository's agent overrides one of yours with the same name,
|
|
137
|
-
and both override the built-in types.
|
|
137
|
+
and both override the built-in types. A repository's agents are used only after you
|
|
138
|
+
[approve them](commands.md#approving-a-repositorys-commands-skills-and-agents), together with its
|
|
139
|
+
commands and skills. `/agents` and `lcode doctor` point out files that couldn't be
|
|
138
140
|
read.
|
|
139
141
|
|
|
140
142
|
## Settings
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Commands and skills
|
|
2
|
+
|
|
3
|
+
Teams repeat the same requests: "review this diff against our checklist", "write a migration the
|
|
4
|
+
way we do it", the release steps. `AGENTS.md` can't hold all of that, because it goes into every
|
|
5
|
+
request and every line costs context. lcode has two ways to keep such instructions ready without
|
|
6
|
+
paying for them until they're used.
|
|
7
|
+
|
|
8
|
+
| | Command | Skill |
|
|
9
|
+
|---|---|---|
|
|
10
|
+
| What it is | A prompt template | Instructions, plus scripts and reference files if needed |
|
|
11
|
+
| Who starts it | You, with `/name args` | The model, when a task matches its description, or you with `/name` |
|
|
12
|
+
| Context cost until used | Nothing | Its name and one-line description |
|
|
13
|
+
| Format | `<name>.md` | A folder with a `SKILL.md`, in the [Agent Skills](https://agentskills.io) format |
|
|
14
|
+
|
|
15
|
+
## Commands
|
|
16
|
+
|
|
17
|
+
A command is a markdown file whose body is the request to send. `$ARGUMENTS` becomes everything
|
|
18
|
+
you type after the command's name, and `$1` to `$9` single words. If the template has no
|
|
19
|
+
placeholder, what you type is added at the end.
|
|
20
|
+
|
|
21
|
+
```markdown
|
|
22
|
+
---
|
|
23
|
+
description: review the uncommitted changes for bugs and missing tests
|
|
24
|
+
argument-hint: "[path or what to focus on]"
|
|
25
|
+
allowed-tools: read_file grep glob list_dir bash
|
|
26
|
+
---
|
|
27
|
+
Review the uncommitted changes in this repository. $ARGUMENTS
|
|
28
|
+
|
|
29
|
+
Run `git diff` and `git diff --cached` to see them, and read the code around them where needed.
|
|
30
|
+
Report bugs first, with `path:line`, then missing tests. Don't change any files.
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
❯ /review the parser changes
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
| Frontmatter (all optional) | |
|
|
38
|
+
|---|---|
|
|
39
|
+
| `description` | Shown in `/help` and completion (default: the first line) |
|
|
40
|
+
| `argument-hint` | Shown after the name in `/help`, e.g. `[path]` |
|
|
41
|
+
| `allowed-tools` | The only tools the model gets for this request, e.g. `read_file grep bash` (lcode's tool names) |
|
|
42
|
+
|
|
43
|
+
| Folder | Commands |
|
|
44
|
+
|---|---|
|
|
45
|
+
| `.lcode/commands/<name>.md` in the repository | For this repository; commit them to share them |
|
|
46
|
+
| `~/.config/lcode/commands/<name>.md` | For every repository |
|
|
47
|
+
|
|
48
|
+
The file name is the command's name. A repository's command overrides one of yours with the same
|
|
49
|
+
name; built-in commands such as `/help` can't be replaced.
|
|
50
|
+
|
|
51
|
+
## Skills
|
|
52
|
+
|
|
53
|
+
A skill is a folder with a `SKILL.md`: a frontmatter with a `name` and a `description` that says
|
|
54
|
+
what the skill does and when to use it, then instructions. Scripts, templates and reference files
|
|
55
|
+
can sit next to it.
|
|
56
|
+
|
|
57
|
+
```text
|
|
58
|
+
.lcode/skills/commit-message/
|
|
59
|
+
├── SKILL.md
|
|
60
|
+
└── scripts/
|
|
61
|
+
└── staged.sh
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```markdown
|
|
65
|
+
---
|
|
66
|
+
name: commit-message
|
|
67
|
+
description: Writes a git commit message for the staged changes, in the style the repository
|
|
68
|
+
already uses. Use when the user asks for a commit message, or asks you to commit their changes.
|
|
69
|
+
---
|
|
70
|
+
# Commit messages
|
|
71
|
+
|
|
72
|
+
1. Run `scripts/staged.sh` from this skill's folder. It prints the staged files and the subjects
|
|
73
|
+
of the last 15 commits.
|
|
74
|
+
2. Match the style of the recent subjects …
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
How lcode uses them, step by step, so they cost almost nothing until needed:
|
|
78
|
+
|
|
79
|
+
1. At the start of a session, the model gets only each skill's name and description.
|
|
80
|
+
2. When a task matches a description, the model calls the `skill` tool. It gets the instructions,
|
|
81
|
+
the skill's folder and the list of files in it, but not their contents.
|
|
82
|
+
3. The model reads or runs those files when the instructions call for them. Files in a skill's
|
|
83
|
+
folder can be read even when the [sandbox](sandbox.md) limits the model to the project.
|
|
84
|
+
|
|
85
|
+
You can also start a skill yourself: `/commit-message` or `/commit-message only the parser
|
|
86
|
+
changes`. After the conversation is compacted, the model is told which skills were in use, so it
|
|
87
|
+
can load them again.
|
|
88
|
+
|
|
89
|
+
lcode reads skills from these folders; a repository's skill overrides one of yours with the same
|
|
90
|
+
name:
|
|
91
|
+
|
|
92
|
+
| Folder | |
|
|
93
|
+
|---|---|
|
|
94
|
+
| `.lcode/skills/`, `.agents/skills/`, `.claude/skills/` in the repository | For this repository |
|
|
95
|
+
| `~/.config/lcode/skills/`, `~/.agents/skills/`, `~/.claude/skills/` | For every repository |
|
|
96
|
+
|
|
97
|
+
`.agents/skills/` is the folder agents share by convention, and `.claude/skills/` is read too, so
|
|
98
|
+
skills you already have for other agents work in lcode. If other agents installed many skills you
|
|
99
|
+
don't need here, `lcode config set skills lcode` limits lcode to its own folders (`skills off` turns
|
|
100
|
+
skills off). However many there are, the list in the model's instructions stays within about 5% of
|
|
101
|
+
the context window: with many skills, each description is shortened so that all of them stay
|
|
102
|
+
listed. The same skill installed in two folders is used once. The format is the
|
|
103
|
+
[Agent Skills specification](https://agentskills.io/specification); like other agents, lcode is
|
|
104
|
+
lenient with skills that bend its rules (a name with capital letters, an unquoted colon in a
|
|
105
|
+
description) and skips only those without a description. `/help` lists the skills it found and
|
|
106
|
+
any it skipped.
|
|
107
|
+
|
|
108
|
+
## Approving a repository's commands, skills and agents
|
|
109
|
+
|
|
110
|
+
A repository's commands, skills and [agents](agents.md#custom-agents) steer the model, and skills
|
|
111
|
+
can bring scripts. A freshly cloned repository shouldn't be able to do that silently, so the first
|
|
112
|
+
time you start lcode in a repository that has any, it asks:
|
|
113
|
+
|
|
114
|
+
```text
|
|
115
|
+
This repository brings its own commands, skills or agents:
|
|
116
|
+
commands: /review
|
|
117
|
+
skills: commit-message
|
|
118
|
+
They can steer the model and include scripts it may run (commands still ask first, unless you
|
|
119
|
+
allow them).
|
|
120
|
+
Use them? [y/N]
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
lcode asks again whenever any of their files change. Until you say yes, only your own commands and
|
|
124
|
+
skills are used. `lcode -p` never asks and doesn't use them.
|
|
125
|
+
|
|
126
|
+
## Examples
|
|
127
|
+
|
|
128
|
+
The lcode repository has a ready-made command and skill in
|
|
129
|
+
[`examples/`](https://github.com/nasser1941/lcode/tree/main/examples): `/review` and the
|
|
130
|
+
`commit-message` skill above. Copy them into `.lcode/` of a repository, or into
|
|
131
|
+
`~/.config/lcode/` to have them everywhere.
|
|
@@ -31,6 +31,7 @@ lcode config path # print the file location
|
|
|
31
31
|
| `vision_model` | `auto` | The model that [looks at images](usage.md#images): `auto`, `off` or an Ollama model that can see |
|
|
32
32
|
| `mcp_tools` | `auto` | How [MCP](mcp.md#context) tool definitions reach the model: `auto`, `direct` or `search` (on demand) |
|
|
33
33
|
| `memory` | `ask` | [Notes that carry over](memory.md) to later sessions: `ask` (confirm each), `auto` or `off` |
|
|
34
|
+
| `skills` | `all` | Which [skills](commands.md#skills) the model is offered: `all` (lcode's folders and the ones other agents share), `lcode` (only `.lcode/skills/` and `~/.config/lcode/skills/`) or `off` |
|
|
34
35
|
| `subagents` | `true` | Let the model hand tasks to [subagents](agents.md) with their own context |
|
|
35
36
|
| `max_parallel_agents` | `1` | Subagents that run at the same time; more needs `OLLAMA_NUM_PARALLEL` on the Ollama server ([details](agents.md#several-at-once)) |
|
|
36
37
|
| `checkpoints` | `true` | Save a checkpoint before the model changes files, so [`/undo`](usage.md#undo-and-checkpoints) can restore them |
|
|
@@ -74,6 +75,8 @@ Environment variables override the file, which is useful for one-off runs and CI
|
|
|
74
75
|
| `~/.local/state/lcode/mcp-logs/` | Error output of local MCP servers |
|
|
75
76
|
| `~/.local/state/lcode/checkpoints/` | Checkpoints for `/undo` (copies of your project's files; deleted after 14 days) |
|
|
76
77
|
| `~/.local/state/lcode/memory/` | [Memory](memory.md) notes: `user/` for every repository, `projects/<repository>/` for each one |
|
|
78
|
+
| `~/.config/lcode/commands/`, `~/.config/lcode/skills/` | Your [commands and skills](commands.md) (a repository's go in `.lcode/`) |
|
|
79
|
+
| `~/.local/state/lcode/extensions-approved.json` | Repositories whose commands, skills and agents you approved |
|
|
77
80
|
| `~/.config/lcode/agents/` | Your [custom agents](agents.md#custom-agents) (a repository's go in `.lcode/agents/`) |
|
|
78
81
|
| `~/.local/state/lcode/limits.json` | Context sizes that ran out of GPU memory on this machine (safe to delete) |
|
|
79
82
|
|
|
@@ -85,10 +85,13 @@ the Ollama server you configure, it only contacts the web when the model searche
|
|
|
85
85
|
| `agent.py` | System prompt, streaming, tool loop, compaction, sessions |
|
|
86
86
|
| `tools.py` | Tool schemas and implementations |
|
|
87
87
|
| `permissions.py` | Approval prompts and the read-only allowlist |
|
|
88
|
+
| `servers/` | The MCP servers lcode ships for services without one: Encord, Valohai |
|
|
88
89
|
| `mcp/` | MCP client: stdio and HTTP transports, OAuth sign-in, server settings, the catalog, `lcode mcp` |
|
|
89
90
|
| `bench.py` | `lcode bench`: the benchmark tasks, their checks and the reports |
|
|
90
91
|
| `vision.py` | Looking at images with a model that can see |
|
|
91
92
|
| `subagents.py` | Subagents: agent types, running them (also in parallel), worktrees for workers |
|
|
93
|
+
| `extensions.py` | Custom commands and skills, and approving a repository's own |
|
|
94
|
+
| `frontmatter.py` | The `---` headers of notes, agents, commands and skills |
|
|
92
95
|
| `planning.py` | Plan mode: what it allows, presenting a plan and approving it |
|
|
93
96
|
| `memory.py` | Notes that carry over between sessions, and the end-of-session check |
|
|
94
97
|
| `sandbox.py` | The optional container for shell commands |
|
|
@@ -35,13 +35,16 @@ and find the code for the top one."*
|
|
|
35
35
|
| `kubernetes` | Pods, deployments, logs and events, read-only | `npx` and a kubeconfig |
|
|
36
36
|
| `linear` | Issues, projects and cycles | a Linear account (browser sign-in) |
|
|
37
37
|
| `notion` | Pages and databases | a Notion account (browser sign-in) |
|
|
38
|
+
| `metabase` | Explore your data and ask questions through Metabase's semantic layer | Metabase 60 or later with MCP on ([below](#metabase)) |
|
|
39
|
+
| `encord` | Projects, datasets, ontologies, labeling progress, tasks and labels, read-only | `uvx`, an SSH key registered in Encord ([below](#encord)) |
|
|
40
|
+
| `valohai` | ML executions with their logs, metrics and outputs, and pipelines, read-only | `uvx`, a Valohai API token ([below](#valohai)) |
|
|
38
41
|
|
|
39
42
|
`npx` comes with [Node.js](https://nodejs.org) (18 or newer) and `uvx` with
|
|
40
43
|
[uv](https://docs.astral.sh/uv/getting-started/installation/). `lcode mcp catalog` shows what's missing
|
|
41
44
|
on your machine.
|
|
42
45
|
|
|
43
46
|
Servers that can change things start read-only where the server supports it (`aws`, `postgres`,
|
|
44
|
-
`kubernetes`); the setup note tells you which setting to change to allow writes.
|
|
47
|
+
`kubernetes`, `encord`, `valohai`); the setup note tells you which setting to change to allow writes.
|
|
45
48
|
|
|
46
49
|
### Signing in
|
|
47
50
|
|
|
@@ -134,6 +137,51 @@ size, prompt), which can take several minutes of trial and error. Once an image
|
|
|
134
137
|
lcode to save that workflow in your project (for example `assets/icon.workflow.json`) and reuse it:
|
|
135
138
|
later images are a single `run_workflow` call.
|
|
136
139
|
|
|
140
|
+
### Metabase
|
|
141
|
+
|
|
142
|
+
Metabase has its own MCP server inside every instance (Metabase 60 and later), at
|
|
143
|
+
`/api/metabase-mcp`. An admin switches it on under **Admin > AI > MCP**. Then:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
lcode mcp add metabase # asks for your Metabase address, then signs in in the browser
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
You sign in with your Metabase account, and the model sees exactly the data your Metabase
|
|
150
|
+
permissions allow. See [Metabase's MCP docs](https://www.metabase.com/docs/latest/ai/mcp).
|
|
151
|
+
|
|
152
|
+
### Encord
|
|
153
|
+
|
|
154
|
+
Encord has no MCP server of its own, so lcode ships one: `lcode-mcp-encord`, built on the Encord SDK
|
|
155
|
+
and run with `uvx --from "lcode-cli[encord]"`. It signs in with an SSH key that you register in
|
|
156
|
+
Encord under **Settings > Public keys**; `lcode mcp add encord` asks for the key file's path.
|
|
157
|
+
|
|
158
|
+
| Tool | |
|
|
159
|
+
|---|---|
|
|
160
|
+
| `list_projects`, `list_datasets` | What you can see |
|
|
161
|
+
| `get_project`, `get_ontology` | A project's datasets, ontology classes and workflow stages |
|
|
162
|
+
| `workflow_progress` | How many tasks are in each workflow stage, by status |
|
|
163
|
+
| `list_tasks` | Data units with their stage, status and last edit, filtered by stage or title |
|
|
164
|
+
| `get_labels` | The labels on one data unit: counts per class and the label JSON |
|
|
165
|
+
| `assign_task`, `set_priority` | Only with `--allow-writes` in the server's `args` in `mcp.json` |
|
|
166
|
+
|
|
167
|
+
### Valohai
|
|
168
|
+
|
|
169
|
+
Valohai has no MCP server of its own either, so lcode ships `lcode-mcp-valohai`, which talks to
|
|
170
|
+
Valohai's REST API. It needs an API token (**My Profile > Authentication > Manage tokens**), and the
|
|
171
|
+
address of a self-hosted installation if you use one; `lcode mcp add valohai` asks for both.
|
|
172
|
+
|
|
173
|
+
| Tool | |
|
|
174
|
+
|---|---|
|
|
175
|
+
| `list_projects`, `list_pipelines` | Projects and their pipelines |
|
|
176
|
+
| `list_executions`, `get_execution` | Executions with their status, parameters, metrics, outputs and errors |
|
|
177
|
+
| `get_execution_logs` | The last lines of an execution's log, optionally only stderr |
|
|
178
|
+
| `list_outputs` | The files an execution produced, with `datum://` URIs to use as inputs |
|
|
179
|
+
| `compare_executions` | Metrics and differing parameters of several executions side by side |
|
|
180
|
+
| `start_execution`, `stop_execution` | Only with `--allow-writes` in the server's `args` in `mcp.json` |
|
|
181
|
+
|
|
182
|
+
Both servers are ordinary MCP servers: other MCP clients can use them too, for example
|
|
183
|
+
`uvx --from lcode-cli lcode-mcp-valohai` with `VALOHAI_TOKEN` set.
|
|
184
|
+
|
|
137
185
|
## Adding your own servers
|
|
138
186
|
|
|
139
187
|
Any MCP server works. For a remote server, give its URL; for a local one, the command that starts it:
|
|
@@ -59,6 +59,7 @@ reasoning is on.
|
|
|
59
59
|
| `/undo` | Undo the file changes of the last request ([details](#undo-and-checkpoints)) |
|
|
60
60
|
| `/rewind [N]` | Go back to before request N: its files, and optionally the conversation |
|
|
61
61
|
| `/checkpoints` | List the requests that changed files, and which files |
|
|
62
|
+
| `/name [args]` | Run one of your [commands or skills](commands.md); `/help` lists them |
|
|
62
63
|
| `/agents [N]` | [Subagent](agents.md) types, and what this session's subagents did |
|
|
63
64
|
| `/remember [-g] TEXT` | Save a [note](memory.md) for later sessions (`-g`: for every repository) |
|
|
64
65
|
| `/memory [show\|edit\|delete N]` | The [notes](memory.md) lcode remembers |
|
|
@@ -92,6 +93,7 @@ reasoning is on.
|
|
|
92
93
|
| `view_image` | Look at an image: a model that can see describes it ([Images](#images)) |
|
|
93
94
|
| `agent` | Hand a task to a [subagent](agents.md) with its own context; only its report comes back |
|
|
94
95
|
| `memory` | Save, update or delete [notes](memory.md) that later sessions load |
|
|
96
|
+
| `skill` | Load a [skill](commands.md#skills)'s instructions when a task matches it |
|
|
95
97
|
| `present_plan` | In [plan mode](#plan-mode): show the plan and ask for approval |
|
|
96
98
|
|
|
97
99
|
lcode refuses to edit a file the model hasn't read in the session, or one that changed on disk since
|
|
@@ -276,6 +278,9 @@ At startup lcode reads `AGENTS.md` (or `LCODE.md`, or `CLAUDE.md`) from the work
|
|
|
276
278
|
adds it to the model's instructions. Use it for build and test commands, architecture notes and
|
|
277
279
|
conventions. `/init` writes a first version for you.
|
|
278
280
|
|
|
281
|
+
Instructions that are only needed for some tasks fit better in a [command or skill](commands.md),
|
|
282
|
+
which costs no context until it's used.
|
|
283
|
+
|
|
279
284
|
What doesn't belong in `AGENTS.md` but should carry over, such as your corrections and preferences,
|
|
280
285
|
goes into lcode's [memory](memory.md): short notes the model, you (`/remember`) or a short check at
|
|
281
286
|
the end of a session save, and that every later session in the repository loads.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Examples
|
|
2
|
+
|
|
3
|
+
Ready-made extensions for lcode. Copy them into a repository (or into `~/.config/lcode/` to use
|
|
4
|
+
them everywhere):
|
|
5
|
+
|
|
6
|
+
| Example | Copy to | Use it |
|
|
7
|
+
|---|---|---|
|
|
8
|
+
| [`commands/review.md`](commands/review.md) | `.lcode/commands/review.md` | `/review` or `/review the parser` |
|
|
9
|
+
| [`skills/commit-message/`](skills/commit-message/) | `.lcode/skills/commit-message/` | ask for a commit message, or `/commit-message` |
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
mkdir -p .lcode/commands .lcode/skills
|
|
13
|
+
cp examples/commands/review.md .lcode/commands/
|
|
14
|
+
cp -r examples/skills/commit-message .lcode/skills/
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
See [Commands and skills](https://nasser1941.github.io/lcode/commands/) for the format.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: review the uncommitted changes for bugs and missing tests
|
|
3
|
+
argument-hint: "[path or what to focus on]"
|
|
4
|
+
allowed-tools: read_file grep glob list_dir bash
|
|
5
|
+
---
|
|
6
|
+
Review the uncommitted changes in this repository. $ARGUMENTS
|
|
7
|
+
|
|
8
|
+
Run `git diff` and `git diff --cached` to see them, and read the code around them where needed.
|
|
9
|
+
|
|
10
|
+
Report, most important first:
|
|
11
|
+
1. Bugs: wrong behavior, unhandled errors and edge cases, with `path:line`.
|
|
12
|
+
2. Missing or weak tests for the changed behavior.
|
|
13
|
+
3. Anything that doesn't match the code around it.
|
|
14
|
+
|
|
15
|
+
Don't change any files.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: commit-message
|
|
3
|
+
description: Writes a git commit message for the staged changes, in the style the repository already uses. Use when the user asks for a commit message, or asks you to commit their changes.
|
|
4
|
+
license: MIT
|
|
5
|
+
---
|
|
6
|
+
# Commit messages
|
|
7
|
+
|
|
8
|
+
1. Run `scripts/staged.sh` from this skill's folder (with its absolute path). It prints the staged
|
|
9
|
+
files and the subjects of the last 15 commits.
|
|
10
|
+
2. If nothing is staged, tell the user and stop. Don't stage files yourself unless they asked.
|
|
11
|
+
3. Read the staged diff (`git diff --cached`) of the files that matter.
|
|
12
|
+
4. Match the style of the recent subjects: imperative mood or not, prefixes such as `feat:` or
|
|
13
|
+
`fix(scope):` only if the repository uses them, capitalization and length.
|
|
14
|
+
5. Write a subject under 72 characters that says what the change does. For anything but a trivial
|
|
15
|
+
change, add a blank line and a short body that says why, wrapped at 72 characters.
|
|
16
|
+
6. Show the message. Commit only if the user asked you to: `git commit -F -` with the message on
|
|
17
|
+
standard input.
|
|
@@ -35,6 +35,9 @@ dependencies = [
|
|
|
35
35
|
"tomli>=2.0; python_version < '3.11'",
|
|
36
36
|
]
|
|
37
37
|
|
|
38
|
+
[project.optional-dependencies]
|
|
39
|
+
encord = ["encord>=0.1.200"] # for lcode-mcp-encord
|
|
40
|
+
|
|
38
41
|
[project.urls]
|
|
39
42
|
Homepage = "https://nasser1941.github.io/lcode/"
|
|
40
43
|
Documentation = "https://nasser1941.github.io/lcode/"
|
|
@@ -44,6 +47,8 @@ Changelog = "https://github.com/nasser1941/lcode/blob/main/CHANGELOG.md"
|
|
|
44
47
|
|
|
45
48
|
[project.scripts]
|
|
46
49
|
lcode = "lcode.cli:main"
|
|
50
|
+
lcode-mcp-valohai = "lcode.servers.valohai:main"
|
|
51
|
+
lcode-mcp-encord = "lcode.servers.encord:main"
|
|
47
52
|
|
|
48
53
|
[dependency-groups]
|
|
49
54
|
dev = ["pytest>=8", "ruff>=0.6"]
|
|
@@ -72,6 +77,7 @@ ignore = [
|
|
|
72
77
|
"src/lcode/memory.py" = ["E501"]
|
|
73
78
|
"src/lcode/subagents.py" = ["E501"]
|
|
74
79
|
"src/lcode/planning.py" = ["E501"]
|
|
80
|
+
"src/lcode/extensions.py" = ["E501"]
|
|
75
81
|
|
|
76
82
|
[tool.pytest.ini_options]
|
|
77
83
|
testpaths = ["tests"]
|
|
@@ -21,7 +21,7 @@ from rich.markup import escape
|
|
|
21
21
|
from rich.panel import Panel
|
|
22
22
|
from rich.text import Text
|
|
23
23
|
|
|
24
|
-
from lcode import catalog, limits, planning, sessions, subagents, vision, web
|
|
24
|
+
from lcode import catalog, extensions, limits, planning, sessions, subagents, vision, web
|
|
25
25
|
from lcode import memory as memory_notes
|
|
26
26
|
from lcode.checkpoints import Checkpoints
|
|
27
27
|
from lcode.config import format_tokens
|
|
@@ -78,7 +78,7 @@ SYSTEM_PROMPT = """You are lcode, an autonomous software-engineering agent runni
|
|
|
78
78
|
|
|
79
79
|
# Top-level layout of the working directory
|
|
80
80
|
{tree}
|
|
81
|
-
{web}{agents}{project}{notes}"""
|
|
81
|
+
{web}{agents}{skills}{project}{notes}"""
|
|
82
82
|
|
|
83
83
|
WEB_PROMPT = """
|
|
84
84
|
# Web access
|
|
@@ -171,6 +171,8 @@ class Settings:
|
|
|
171
171
|
vision_model: str = "auto" # auto, off or an Ollama model that can see images
|
|
172
172
|
memory: str = "off" # off, ask or auto: notes that carry over to later sessions (lcode.memory)
|
|
173
173
|
subagents: bool = False # the agent tool (lcode.subagents)
|
|
174
|
+
trust_project: bool = False # use the repository's own commands, skills and agents (lcode.extensions)
|
|
175
|
+
skills: str = "off" # all, lcode (only lcode's own skill folders) or off
|
|
174
176
|
max_parallel_agents: int = 1
|
|
175
177
|
|
|
176
178
|
|
|
@@ -200,6 +202,8 @@ class Agent:
|
|
|
200
202
|
self._agent_types: tuple[Path, dict[str, subagents.AgentType], list[str]] | None = None
|
|
201
203
|
self.agent_runs: list[subagents.Record] = [] # subagents run in this session, for /agents
|
|
202
204
|
self.plan = "" # the plan the user approved; kept through compaction
|
|
205
|
+
self._extensions: tuple[Path, extensions.Extensions] | None = None
|
|
206
|
+
self.skills_loaded: set[str] = set() # skills whose instructions are in the conversation
|
|
203
207
|
# Set on subagents (see lcode.subagents):
|
|
204
208
|
self.allowed_tools: set[str] | None = None # None: every tool
|
|
205
209
|
self.read_only = False # only read-only shell commands
|
|
@@ -236,8 +240,15 @@ class Agent:
|
|
|
236
240
|
notes=self.memory().prompt(self.settings.context) if self.settings.memory != "off" else "",
|
|
237
241
|
web=self.web_prompt(),
|
|
238
242
|
agents=self.agents_prompt(),
|
|
243
|
+
skills=extensions.skills_prompt(self.extensions().skills, self.settings.context),
|
|
239
244
|
)
|
|
240
245
|
|
|
246
|
+
def extensions(self) -> extensions.Extensions:
|
|
247
|
+
"""Custom commands and skills for the current folder (a repository's only once approved)."""
|
|
248
|
+
if self._extensions is None or self._extensions[0] != self.cwd:
|
|
249
|
+
self._extensions = (self.cwd, extensions.load(self.cwd, self.settings.trust_project, self.settings.skills))
|
|
250
|
+
return self._extensions[1]
|
|
251
|
+
|
|
241
252
|
def agents_prompt(self) -> str:
|
|
242
253
|
if not self.settings.subagents:
|
|
243
254
|
return ""
|
|
@@ -252,7 +263,7 @@ class Agent:
|
|
|
252
263
|
def agent_types(self) -> dict[str, subagents.AgentType]:
|
|
253
264
|
"""Built-in and custom agent types for the current folder."""
|
|
254
265
|
if self._agent_types is None or self._agent_types[0] != self.cwd:
|
|
255
|
-
types, problems = subagents.load_types(self.cwd)
|
|
266
|
+
types, problems = subagents.load_types(self.cwd, self.settings.trust_project)
|
|
256
267
|
self._agent_types = (self.cwd, types, problems)
|
|
257
268
|
return self._agent_types[1]
|
|
258
269
|
|
|
@@ -290,6 +301,8 @@ class Agent:
|
|
|
290
301
|
schemas.append(subagents.schema(self.agent_types(), self.settings.max_parallel_agents))
|
|
291
302
|
if self.planning():
|
|
292
303
|
schemas.append(PRESENT_PLAN_SCHEMA)
|
|
304
|
+
if self.extensions().skills:
|
|
305
|
+
schemas.append(extensions.schema(self.extensions().skills))
|
|
293
306
|
if self.mcp:
|
|
294
307
|
schemas += self.mcp.schemas(self.settings.context)
|
|
295
308
|
if self.allowed_tools is not None:
|
|
@@ -409,6 +422,7 @@ class Agent:
|
|
|
409
422
|
|
|
410
423
|
def new_session(self) -> None:
|
|
411
424
|
self.reset()
|
|
425
|
+
self.skills_loaded.clear()
|
|
412
426
|
self.session_id = self.new_session_id()
|
|
413
427
|
self.session_name = ""
|
|
414
428
|
self.session_title = ""
|
|
@@ -606,6 +620,8 @@ class Agent:
|
|
|
606
620
|
return f"list_dir({args.get('path', '.')})"
|
|
607
621
|
if name == "memory":
|
|
608
622
|
return f"memory({' '.join(str(args.get(k) or '') for k in ('action', 'name')).strip()})"
|
|
623
|
+
if name == "skill":
|
|
624
|
+
return f"skill({args.get('name', '')})"
|
|
609
625
|
if name == "agent":
|
|
610
626
|
return f"agent({args.get('type', '')}: {args.get('description') or str(args.get('task', ''))[:50]})"
|
|
611
627
|
if name == "bash":
|
|
@@ -787,6 +803,12 @@ class Agent:
|
|
|
787
803
|
]
|
|
788
804
|
if self.plan: # the approved plan stays word for word
|
|
789
805
|
self.messages[1]["content"] += f"\n\n[The plan the user approved; keep following it]\n\n{self.plan}"
|
|
806
|
+
if self.skills_loaded: # their instructions were in the old messages: load them again when needed
|
|
807
|
+
names = ", ".join(sorted(self.skills_loaded))
|
|
808
|
+
self.messages[1]["content"] += (
|
|
809
|
+
f"\n\n[Skills in use before the summary: {names}. Load them again with the skill tool if you still need them.]"
|
|
810
|
+
)
|
|
811
|
+
self.skills_loaded.clear()
|
|
790
812
|
self.ctx_used = sum(len(m["content"]) for m in self.messages) // 3
|
|
791
813
|
self.reflected = len(self.messages)
|
|
792
814
|
self.console.print(Panel(Markdown(summary), title="Compacted summary", border_style="blue"))
|