@kmugalkhod/lightcode 0.17.2 → 0.18.0
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/README.md +197 -197
- package/assets/web/index-ghcpktm7.js +183 -0
- package/assets/web/index-n305tms3.css +1 -0
- package/assets/web/index.html +23 -23
- package/cli.js +5243 -4663
- package/package.json +1 -1
- package/server.js +837 -176
- package/assets/grammars/c/highlights.scm +0 -341
- package/assets/grammars/c/tree-sitter-c.wasm +0 -0
- package/assets/grammars/cpp/highlights.scm +0 -74
- package/assets/grammars/cpp/tree-sitter-cpp.wasm +0 -0
- package/assets/grammars/css/highlights.scm +0 -109
- package/assets/grammars/css/tree-sitter-css.wasm +0 -0
- package/assets/grammars/go/highlights.scm +0 -123
- package/assets/grammars/go/tree-sitter-go.wasm +0 -0
- package/assets/grammars/html/highlights.scm +0 -7
- package/assets/grammars/html/tree-sitter-html.wasm +0 -0
- package/assets/grammars/json/highlights.scm +0 -38
- package/assets/grammars/json/tree-sitter-json.wasm +0 -0
- package/assets/grammars/python/highlights.scm +0 -443
- package/assets/grammars/python/tree-sitter-python.wasm +0 -0
- package/assets/grammars/rust/highlights.scm +0 -159
- package/assets/grammars/rust/tree-sitter-rust.wasm +0 -0
- package/assets/grammars/yaml/highlights.scm +0 -99
- package/assets/grammars/yaml/tree-sitter-yaml.wasm +0 -0
- package/assets/web/index-5zxr27sp.js +0 -171
- package/assets/web/index-7g2m4nsk.css +0 -1
package/README.md
CHANGED
|
@@ -1,197 +1,197 @@
|
|
|
1
|
-
# Lightcode
|
|
2
|
-
|
|
3
|
-
A personal AI coding agent with terminal and localhost browser interfaces.
|
|
4
|
-
Lightcode pairs an OpenTUI client and a React browser workspace with one local
|
|
5
|
-
Hono API server, persistent SQLite sessions, a
|
|
6
|
-
permission-gated tool suite (files, shell, git, web, MCP), and tiered context
|
|
7
|
-
optimization that keeps long sessions inside the model's context window
|
|
8
|
-
without ever losing history.
|
|
9
|
-
|
|
10
|
-
## Install
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
npm install -g @kmugalkhod/lightcode
|
|
14
|
-
lightcode # terminal UI
|
|
15
|
-
lightcode web # browser UI on 127.0.0.1
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
Works on macOS (Apple Silicon and Intel), Linux, and Windows. Bun ships with
|
|
19
|
-
the package, so there's nothing else to install — the first `lightcode` run
|
|
20
|
-
uses the bundled runtime automatically (and reuses a system Bun if you already
|
|
21
|
-
have one). The published package is scoped as `@kmugalkhod/lightcode`; the
|
|
22
|
-
command it installs is `lightcode`.
|
|
23
|
-
|
|
24
|
-
The two interfaces share the same local sessions, history, provider settings,
|
|
25
|
-
and agent engine. `lightcode web` opens a dedicated loopback-only server and
|
|
26
|
-
launches your browser. Opening a project uses the host folder chooser first:
|
|
27
|
-
the Windows or macOS system dialog, then Zenity or KDialog on Linux when
|
|
28
|
-
available in a graphical session. If the system chooser is unavailable or
|
|
29
|
-
cannot open—including Linux without Zenity or KDialog—Lightcode falls back to
|
|
30
|
-
an authenticated in-app browser rooted at Home, Desktop, Documents, Downloads,
|
|
31
|
-
and Projects. That bounded browser is also available as a secondary project
|
|
32
|
-
action. The local server—not the browser page—receives and
|
|
33
|
-
canonicalizes the selected path, rejects filesystem, drive, and UNC share
|
|
34
|
-
roots, and grants only the chosen project; cancelling leaves the current
|
|
35
|
-
workspace unchanged. The per-launch browser credential stays in the URL
|
|
36
|
-
fragment and current tab and is never passed to agent subprocesses.
|
|
37
|
-
|
|
38
|
-
The browser rail stays focused on projects and sessions. Agents, Skills, MCP,
|
|
39
|
-
Plugins, and deeper customization remain managed through the terminal
|
|
40
|
-
interface for now.
|
|
41
|
-
|
|
42
|
-
The first browser release runs one Lightcode interface at a time: press Ctrl+C
|
|
43
|
-
to stop the TUI or browser server before switching. Sessions remain available
|
|
44
|
-
when you reopen them in the other interface. Use `lightcode web --no-open` on
|
|
45
|
-
headless systems; set `LIGHTCODE_WEB_PORT` to choose its starting port.
|
|
46
|
-
|
|
47
|
-
## Quick start (from source)
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
bun install
|
|
51
|
-
bun run cli:dev # starts the TUI; it boots the server automatically
|
|
52
|
-
bun run web:build && bun apps/cli/src/index.tsx web # browser UI from source
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
Lightcode is aware of the directory you launch it in: each turn it reads the
|
|
56
|
-
project's shape (top-level files and git branch/status), uses root `AGENTS.md`
|
|
57
|
-
instructions with `CLAUDE.md` as a fallback, and loads nested instructions only
|
|
58
|
-
when related paths are accessed. `README.md` remains ordinary project context,
|
|
59
|
-
not privileged instructions.
|
|
60
|
-
|
|
61
|
-
On first run Lightcode walks you through provider setup (Anthropic,
|
|
62
|
-
OpenRouter, OpenCode Zen, or any OpenAI-compatible endpoint) and stores the
|
|
63
|
-
API key in `~/.lightcode/credentials.json`. Environment variables such as
|
|
64
|
-
`ANTHROPIC_API_KEY` always take precedence.
|
|
65
|
-
|
|
66
|
-
## Commands
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
bun run cli:dev # TUI (auto-starts the server)
|
|
70
|
-
bun run web:dev # asset-only browser dev server (no agent API proxy)
|
|
71
|
-
bun run web:build # build the browser assets
|
|
72
|
-
bun run server:dev # API server alone, watch mode
|
|
73
|
-
bun run typecheck # TypeScript + tool schema preflight
|
|
74
|
-
bun test # test suite
|
|
75
|
-
bun run build # build the publishable package into dist/
|
|
76
|
-
bun run release # verify + build + npm pack (--publish to release)
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
## Configuration
|
|
80
|
-
|
|
81
|
-
Settings merge from `~/.lightcode/settings.json`, then
|
|
82
|
-
`.lightcode/settings.json` in the project, then `LIGHTCODE_*` environment
|
|
83
|
-
variables. Notable keys:
|
|
84
|
-
|
|
85
|
-
| Key | Purpose |
|
|
86
|
-
| --- | --- |
|
|
87
|
-
| `provider`, `model`, `baseUrl` | Provider selection and model id |
|
|
88
|
-
| `defaultMode` | `build` or `plan` |
|
|
89
|
-
| `permissionMode`, `permissions` | Tool permission policy |
|
|
90
|
-
| `context.compactAtFraction` | Context compaction threshold (default 0.8) |
|
|
91
|
-
| `context.pruneAtFraction` | Tool-output pruning threshold (default 0.6) |
|
|
92
|
-
| `context.contextWindowOverride` | Override the model context window |
|
|
93
|
-
| `webSearch.backend` | `auto`, `provider`, `brave`, `tavily`, or `disabled` |
|
|
94
|
-
| `webSearch.maxResults`, `webSearch.maxUsesPerTurn` | Bound search results and per-turn search usage |
|
|
95
|
-
| `maxRetries` | Provider-call retries for transient errors (default 5) |
|
|
96
|
-
| `autoContinue.stallTimeoutSeconds` | Abort+retry a byte-silent stream (default 300; raise for very slow reasoning models) |
|
|
97
|
-
| `autoContinue.maxErrorRetries` | Auto-resends before surfacing a stream error (default 8) |
|
|
98
|
-
| `LIGHTCODE_DESKTOP_PATH`, `LIGHTCODE_DOCUMENTS_PATH`, `LIGHTCODE_DOWNLOADS_PATH`, `LIGHTCODE_PROJECTS_PATH` | Optional absolute overrides for the secure common-location fallback; they do not change the host-native picker |
|
|
99
|
-
|
|
100
|
-
The local companion server listens on `127.0.0.1:4983` (uncommon on purpose —
|
|
101
|
-
port 3000 belongs to the apps you build). Override with `PORT` for the server
|
|
102
|
-
and `LIGHTCODE_API_URL` for the CLI. Runtime model switching: `/model` in the
|
|
103
|
-
TUI lists every OpenRouter model and persists the choice to
|
|
104
|
-
`~/.lightcode/settings.json`. Diagnostics: `GET /diagnostics/connectivity`
|
|
105
|
-
probes the provider endpoint, and daily JSONL logs live under the Lightcode
|
|
106
|
-
data directory (`logs/`).
|
|
107
|
-
|
|
108
|
-
## Office networks and certificates
|
|
109
|
-
|
|
110
|
-
Lightcode uses the same standard enterprise configuration described in
|
|
111
|
-
[OpenCode's network documentation](https://opencode.ai/docs/network/):
|
|
112
|
-
`HTTPS_PROXY`, `HTTP_PROXY`, `NO_PROXY`, and `NODE_EXTRA_CA_CERTS`.
|
|
113
|
-
Local CLI/server connections bypass the proxy automatically.
|
|
114
|
-
The npm launcher on Windows also imports trusted roots from both LocalMachine
|
|
115
|
-
and CurrentUser stores when no explicit CA file is configured. Its export is
|
|
116
|
-
isolated per launch and limited to ten seconds.
|
|
117
|
-
|
|
118
|
-
If your office inspects HTTPS traffic, use the company CA bundle supplied by
|
|
119
|
-
your IT team (PEM format):
|
|
120
|
-
|
|
121
|
-
```bash
|
|
122
|
-
export NODE_EXTRA_CA_CERTS=/absolute/path/company-ca.pem
|
|
123
|
-
lightcode
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
`LIGHTCODE_CA_CERTS` and `SSL_CERT_FILE` are also supported for Lightcode's
|
|
127
|
-
provider, model catalog, connectivity probe, and web-tool requests. Explicit
|
|
128
|
-
bundles extend the public trust roots using
|
|
129
|
-
[Bun's TLS fetch options](https://bun.sh/docs/runtime/networking/fetch).
|
|
130
|
-
Certificate verification remains enabled. Untrusted, expired, and mismatched
|
|
131
|
-
certificates report an actionable error instead of triggering repeated chat
|
|
132
|
-
retries. Restart Lightcode after changing network configuration. Subprocesses
|
|
133
|
-
and external MCP programs use their own runtime's certificate settings; use
|
|
134
|
-
`NODE_EXTRA_CA_CERTS` when those runtimes support it.
|
|
135
|
-
|
|
136
|
-
OpenAI-compatible endpoints can run without an API key, including local model
|
|
137
|
-
servers. Supply their `/v1` base URL and exact model ID. Model compatibility
|
|
138
|
-
still depends on the endpoint implementing the supported API and the model
|
|
139
|
-
being capable of tool use; an arbitrary model name alone cannot guarantee that.
|
|
140
|
-
|
|
141
|
-
## Context optimization
|
|
142
|
-
|
|
143
|
-
Long sessions stay healthy through three tiers: real-usage-calibrated token
|
|
144
|
-
estimation, free pruning of stale tool outputs and duplicate file reads, and
|
|
145
|
-
LLM-written summaries once the compaction threshold is crossed (with an
|
|
146
|
-
extractive fallback when the model is unreachable). The full conversation is
|
|
147
|
-
always preserved in SQLite — compaction only changes what the model sees.
|
|
148
|
-
Use `/compact` in a chat to compact manually.
|
|
149
|
-
|
|
150
|
-
## Skills
|
|
151
|
-
|
|
152
|
-
Skills are reusable instruction files the agent can load on demand — a recipe
|
|
153
|
-
for a recurring task (writing a PR description, cutting a release, following a
|
|
154
|
-
review checklist). Each skill is a `SKILL.md` file with frontmatter:
|
|
155
|
-
|
|
156
|
-
```markdown
|
|
157
|
-
---
|
|
158
|
-
name: pr-description
|
|
159
|
-
description: Write a clear PR title and description from the diff.
|
|
160
|
-
---
|
|
161
|
-
|
|
162
|
-
# Instructions the agent follows when this skill is loaded…
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
Lightcode discovers installed skills automatically, first match wins (project
|
|
166
|
-
overrides user), in this order:
|
|
167
|
-
|
|
168
|
-
1. `.lightcode/skills/<name>/SKILL.md` — project-local
|
|
169
|
-
2. `.agents/skills/<name>/SKILL.md` — project-local (fallback)
|
|
170
|
-
3. Project `.claude/skills`, `.codex/skills`, and `.opencode/skills`
|
|
171
|
-
4. User `~/.lightcode/skills`, `~/.agents/skills`, and `~/.claude/skills`
|
|
172
|
-
5. `$CODEX_HOME/skills` (defaults to `~/.codex/skills`, including `.system`)
|
|
173
|
-
6. `$XDG_CONFIG_HOME/opencode/skills` (defaults to `~/.config/opencode/skills`)
|
|
174
|
-
7. Additional roots in `LIGHTCODE_SKILL_PATHS` (colon-separated on Unix,
|
|
175
|
-
semicolon-separated on Windows). Use this for other installations or
|
|
176
|
-
plugin skill directories you want to make available.
|
|
177
|
-
|
|
178
|
-
Each turn the agent is told which skills are available (name + description), so
|
|
179
|
-
just ask it to "use the pr-description skill" (or mention the skill by name) and
|
|
180
|
-
it loads the instructions via the `skill` tool and follows them. Run `/skills`
|
|
181
|
-
in the TUI to list what's installed. The agent can select relevant skills for
|
|
182
|
-
ordinary tasks without you naming one. YAML frontmatter supports quoted and
|
|
183
|
-
multiline `name`/`description` fields. Supporting files can be loaded through
|
|
184
|
-
the `skill` tool's `resource` argument, relative to the skill directory.
|
|
185
|
-
Discovery follows installation symlinks, skips broken/unreadable/malformed
|
|
186
|
-
entries, and refreshes within 30 seconds. Scans are bounded to eight directory
|
|
187
|
-
levels and 2,000 directories per root; individual files are limited to 1 MiB.
|
|
188
|
-
Discovery does not execute skill scripts or override tool permissions.
|
|
189
|
-
|
|
190
|
-
## Workspaces
|
|
191
|
-
|
|
192
|
-
- `apps/cli` — OpenTUI React terminal interface
|
|
193
|
-
- `apps/web` — React localhost browser interface
|
|
194
|
-
- `apps/server` — Hono API server (sessions, streaming, diagnostics)
|
|
195
|
-
- `packages/ai` — agent core: tools, permissions, context engine, config
|
|
196
|
-
- `packages/db` — Prisma + local SQLite storage
|
|
197
|
-
- `packages/shared` — logging, errors, version
|
|
1
|
+
# Lightcode
|
|
2
|
+
|
|
3
|
+
A personal AI coding agent with terminal and localhost browser interfaces.
|
|
4
|
+
Lightcode pairs an OpenTUI client and a React browser workspace with one local
|
|
5
|
+
Hono API server, persistent SQLite sessions, a
|
|
6
|
+
permission-gated tool suite (files, shell, git, web, MCP), and tiered context
|
|
7
|
+
optimization that keeps long sessions inside the model's context window
|
|
8
|
+
without ever losing history.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install -g @kmugalkhod/lightcode
|
|
14
|
+
lightcode # terminal UI
|
|
15
|
+
lightcode web # browser UI on 127.0.0.1
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Works on macOS (Apple Silicon and Intel), Linux, and Windows. Bun ships with
|
|
19
|
+
the package, so there's nothing else to install — the first `lightcode` run
|
|
20
|
+
uses the bundled runtime automatically (and reuses a system Bun if you already
|
|
21
|
+
have one). The published package is scoped as `@kmugalkhod/lightcode`; the
|
|
22
|
+
command it installs is `lightcode`.
|
|
23
|
+
|
|
24
|
+
The two interfaces share the same local sessions, history, provider settings,
|
|
25
|
+
and agent engine. `lightcode web` opens a dedicated loopback-only server and
|
|
26
|
+
launches your browser. Opening a project uses the host folder chooser first:
|
|
27
|
+
the Windows or macOS system dialog, then Zenity or KDialog on Linux when
|
|
28
|
+
available in a graphical session. If the system chooser is unavailable or
|
|
29
|
+
cannot open—including Linux without Zenity or KDialog—Lightcode falls back to
|
|
30
|
+
an authenticated in-app browser rooted at Home, Desktop, Documents, Downloads,
|
|
31
|
+
and Projects. That bounded browser is also available as a secondary project
|
|
32
|
+
action. The local server—not the browser page—receives and
|
|
33
|
+
canonicalizes the selected path, rejects filesystem, drive, and UNC share
|
|
34
|
+
roots, and grants only the chosen project; cancelling leaves the current
|
|
35
|
+
workspace unchanged. The per-launch browser credential stays in the URL
|
|
36
|
+
fragment and current tab and is never passed to agent subprocesses.
|
|
37
|
+
|
|
38
|
+
The browser rail stays focused on projects and sessions. Agents, Skills, MCP,
|
|
39
|
+
Plugins, and deeper customization remain managed through the terminal
|
|
40
|
+
interface for now.
|
|
41
|
+
|
|
42
|
+
The first browser release runs one Lightcode interface at a time: press Ctrl+C
|
|
43
|
+
to stop the TUI or browser server before switching. Sessions remain available
|
|
44
|
+
when you reopen them in the other interface. Use `lightcode web --no-open` on
|
|
45
|
+
headless systems; set `LIGHTCODE_WEB_PORT` to choose its starting port.
|
|
46
|
+
|
|
47
|
+
## Quick start (from source)
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
bun install
|
|
51
|
+
bun run cli:dev # starts the TUI; it boots the server automatically
|
|
52
|
+
bun run web:build && bun apps/cli/src/index.tsx web # browser UI from source
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Lightcode is aware of the directory you launch it in: each turn it reads the
|
|
56
|
+
project's shape (top-level files and git branch/status), uses root `AGENTS.md`
|
|
57
|
+
instructions with `CLAUDE.md` as a fallback, and loads nested instructions only
|
|
58
|
+
when related paths are accessed. `README.md` remains ordinary project context,
|
|
59
|
+
not privileged instructions.
|
|
60
|
+
|
|
61
|
+
On first run Lightcode walks you through provider setup (Anthropic,
|
|
62
|
+
OpenRouter, OpenCode Zen, or any OpenAI-compatible endpoint) and stores the
|
|
63
|
+
API key in `~/.lightcode/credentials.json`. Environment variables such as
|
|
64
|
+
`ANTHROPIC_API_KEY` always take precedence.
|
|
65
|
+
|
|
66
|
+
## Commands
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
bun run cli:dev # TUI (auto-starts the server)
|
|
70
|
+
bun run web:dev # asset-only browser dev server (no agent API proxy)
|
|
71
|
+
bun run web:build # build the browser assets
|
|
72
|
+
bun run server:dev # API server alone, watch mode
|
|
73
|
+
bun run typecheck # TypeScript + tool schema preflight
|
|
74
|
+
bun test # test suite
|
|
75
|
+
bun run build # build the publishable package into dist/
|
|
76
|
+
bun run release # verify + build + npm pack (--publish to release)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Configuration
|
|
80
|
+
|
|
81
|
+
Settings merge from `~/.lightcode/settings.json`, then
|
|
82
|
+
`.lightcode/settings.json` in the project, then `LIGHTCODE_*` environment
|
|
83
|
+
variables. Notable keys:
|
|
84
|
+
|
|
85
|
+
| Key | Purpose |
|
|
86
|
+
| --- | --- |
|
|
87
|
+
| `provider`, `model`, `baseUrl` | Provider selection and model id |
|
|
88
|
+
| `defaultMode` | `build` or `plan` |
|
|
89
|
+
| `permissionMode`, `permissions` | Tool permission policy |
|
|
90
|
+
| `context.compactAtFraction` | Context compaction threshold (default 0.8) |
|
|
91
|
+
| `context.pruneAtFraction` | Tool-output pruning threshold (default 0.6) |
|
|
92
|
+
| `context.contextWindowOverride` | Override the model context window |
|
|
93
|
+
| `webSearch.backend` | `auto`, `provider`, `brave`, `tavily`, or `disabled` |
|
|
94
|
+
| `webSearch.maxResults`, `webSearch.maxUsesPerTurn` | Bound search results and per-turn search usage |
|
|
95
|
+
| `maxRetries` | Provider-call retries for transient errors (default 5) |
|
|
96
|
+
| `autoContinue.stallTimeoutSeconds` | Abort+retry a byte-silent stream (default 300; raise for very slow reasoning models) |
|
|
97
|
+
| `autoContinue.maxErrorRetries` | Auto-resends before surfacing a stream error (default 8) |
|
|
98
|
+
| `LIGHTCODE_DESKTOP_PATH`, `LIGHTCODE_DOCUMENTS_PATH`, `LIGHTCODE_DOWNLOADS_PATH`, `LIGHTCODE_PROJECTS_PATH` | Optional absolute overrides for the secure common-location fallback; they do not change the host-native picker |
|
|
99
|
+
|
|
100
|
+
The local companion server listens on `127.0.0.1:4983` (uncommon on purpose —
|
|
101
|
+
port 3000 belongs to the apps you build). Override with `PORT` for the server
|
|
102
|
+
and `LIGHTCODE_API_URL` for the CLI. Runtime model switching: `/model` in the
|
|
103
|
+
TUI lists every OpenRouter model and persists the choice to
|
|
104
|
+
`~/.lightcode/settings.json`. Diagnostics: `GET /diagnostics/connectivity`
|
|
105
|
+
probes the provider endpoint, and daily JSONL logs live under the Lightcode
|
|
106
|
+
data directory (`logs/`).
|
|
107
|
+
|
|
108
|
+
## Office networks and certificates
|
|
109
|
+
|
|
110
|
+
Lightcode uses the same standard enterprise configuration described in
|
|
111
|
+
[OpenCode's network documentation](https://opencode.ai/docs/network/):
|
|
112
|
+
`HTTPS_PROXY`, `HTTP_PROXY`, `NO_PROXY`, and `NODE_EXTRA_CA_CERTS`.
|
|
113
|
+
Local CLI/server connections bypass the proxy automatically.
|
|
114
|
+
The npm launcher on Windows also imports trusted roots from both LocalMachine
|
|
115
|
+
and CurrentUser stores when no explicit CA file is configured. Its export is
|
|
116
|
+
isolated per launch and limited to ten seconds.
|
|
117
|
+
|
|
118
|
+
If your office inspects HTTPS traffic, use the company CA bundle supplied by
|
|
119
|
+
your IT team (PEM format):
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
export NODE_EXTRA_CA_CERTS=/absolute/path/company-ca.pem
|
|
123
|
+
lightcode
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
`LIGHTCODE_CA_CERTS` and `SSL_CERT_FILE` are also supported for Lightcode's
|
|
127
|
+
provider, model catalog, connectivity probe, and web-tool requests. Explicit
|
|
128
|
+
bundles extend the public trust roots using
|
|
129
|
+
[Bun's TLS fetch options](https://bun.sh/docs/runtime/networking/fetch).
|
|
130
|
+
Certificate verification remains enabled. Untrusted, expired, and mismatched
|
|
131
|
+
certificates report an actionable error instead of triggering repeated chat
|
|
132
|
+
retries. Restart Lightcode after changing network configuration. Subprocesses
|
|
133
|
+
and external MCP programs use their own runtime's certificate settings; use
|
|
134
|
+
`NODE_EXTRA_CA_CERTS` when those runtimes support it.
|
|
135
|
+
|
|
136
|
+
OpenAI-compatible endpoints can run without an API key, including local model
|
|
137
|
+
servers. Supply their `/v1` base URL and exact model ID. Model compatibility
|
|
138
|
+
still depends on the endpoint implementing the supported API and the model
|
|
139
|
+
being capable of tool use; an arbitrary model name alone cannot guarantee that.
|
|
140
|
+
|
|
141
|
+
## Context optimization
|
|
142
|
+
|
|
143
|
+
Long sessions stay healthy through three tiers: real-usage-calibrated token
|
|
144
|
+
estimation, free pruning of stale tool outputs and duplicate file reads, and
|
|
145
|
+
LLM-written summaries once the compaction threshold is crossed (with an
|
|
146
|
+
extractive fallback when the model is unreachable). The full conversation is
|
|
147
|
+
always preserved in SQLite — compaction only changes what the model sees.
|
|
148
|
+
Use `/compact` in a chat to compact manually.
|
|
149
|
+
|
|
150
|
+
## Skills
|
|
151
|
+
|
|
152
|
+
Skills are reusable instruction files the agent can load on demand — a recipe
|
|
153
|
+
for a recurring task (writing a PR description, cutting a release, following a
|
|
154
|
+
review checklist). Each skill is a `SKILL.md` file with frontmatter:
|
|
155
|
+
|
|
156
|
+
```markdown
|
|
157
|
+
---
|
|
158
|
+
name: pr-description
|
|
159
|
+
description: Write a clear PR title and description from the diff.
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
# Instructions the agent follows when this skill is loaded…
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Lightcode discovers installed skills automatically, first match wins (project
|
|
166
|
+
overrides user), in this order:
|
|
167
|
+
|
|
168
|
+
1. `.lightcode/skills/<name>/SKILL.md` — project-local
|
|
169
|
+
2. `.agents/skills/<name>/SKILL.md` — project-local (fallback)
|
|
170
|
+
3. Project `.claude/skills`, `.codex/skills`, and `.opencode/skills`
|
|
171
|
+
4. User `~/.lightcode/skills`, `~/.agents/skills`, and `~/.claude/skills`
|
|
172
|
+
5. `$CODEX_HOME/skills` (defaults to `~/.codex/skills`, including `.system`)
|
|
173
|
+
6. `$XDG_CONFIG_HOME/opencode/skills` (defaults to `~/.config/opencode/skills`)
|
|
174
|
+
7. Additional roots in `LIGHTCODE_SKILL_PATHS` (colon-separated on Unix,
|
|
175
|
+
semicolon-separated on Windows). Use this for other installations or
|
|
176
|
+
plugin skill directories you want to make available.
|
|
177
|
+
|
|
178
|
+
Each turn the agent is told which skills are available (name + description), so
|
|
179
|
+
just ask it to "use the pr-description skill" (or mention the skill by name) and
|
|
180
|
+
it loads the instructions via the `skill` tool and follows them. Run `/skills`
|
|
181
|
+
in the TUI to list what's installed. The agent can select relevant skills for
|
|
182
|
+
ordinary tasks without you naming one. YAML frontmatter supports quoted and
|
|
183
|
+
multiline `name`/`description` fields. Supporting files can be loaded through
|
|
184
|
+
the `skill` tool's `resource` argument, relative to the skill directory.
|
|
185
|
+
Discovery follows installation symlinks, skips broken/unreadable/malformed
|
|
186
|
+
entries, and refreshes within 30 seconds. Scans are bounded to eight directory
|
|
187
|
+
levels and 2,000 directories per root; individual files are limited to 1 MiB.
|
|
188
|
+
Discovery does not execute skill scripts or override tool permissions.
|
|
189
|
+
|
|
190
|
+
## Workspaces
|
|
191
|
+
|
|
192
|
+
- `apps/cli` — OpenTUI React terminal interface
|
|
193
|
+
- `apps/web` — React localhost browser interface
|
|
194
|
+
- `apps/server` — Hono API server (sessions, streaming, diagnostics)
|
|
195
|
+
- `packages/ai` — agent core: tools, permissions, context engine, config
|
|
196
|
+
- `packages/db` — Prisma + local SQLite storage
|
|
197
|
+
- `packages/shared` — logging, errors, version
|