Skip to content

Commit 7392a9a

Browse files
committed
Initial commit
0 parents  commit 7392a9a

227 files changed

Lines changed: 53031 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cursor/rules/nllclw.mdc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
description: nllclw project instructions
3+
alwaysApply: true
4+
---
5+
6+
Use `AGENTS.md` as the canonical project instructions for this repository.

.github/copilot-instructions.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Copilot Instructions
2+
3+
Use `AGENTS.md` as the canonical project instructions for this repository.

.github/workflows/ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
zig:
14+
uses: nullclaw/nullbuilder/.github/workflows/zig-ci.yml@v1
15+
permissions:
16+
contents: read
17+
with:
18+
binary_name: nllclw
19+
artifact_prefix: nllclw
20+
zig_version: "0.16.0"
21+
test_command: |
22+
zig fmt --check build.zig build.zig.zon $(find src -name '*.zig' -type f | sort)
23+
zig build test --summary all
24+
zig build test --summary all -Dshell-tool=true
25+
zig build --release=small
26+
./zig-out/bin/nllclw --help >/dev/null
27+
if strings ./zig-out/bin/nllclw | grep -E 'shell_exec|NLLCLW_SHELL|NLLCLW_TOOL_TIMEOUT_MS|cmd\.exe|sh -c'; then
28+
echo "default binary contains shell-only strings"
29+
exit 1
30+
fi
31+
zig build --release=small -Dshell-tool=true
32+
zig build -Dtarget=x86_64-windows --release=small
33+
zig build -Dtarget=x86_64-linux --release=small
34+
zig build -Dtarget=aarch64-linux --release=small
35+
zig build -Dtarget=aarch64-macos --release=small
36+
zig build -Dtarget=wasm32-wasi --release=small

.github/workflows/release.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ["v*"]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
release:
12+
uses: nullclaw/nullbuilder/.github/workflows/zig-release.yml@v1
13+
permissions:
14+
contents: write
15+
with:
16+
binary_name: nllclw
17+
artifact_prefix: nllclw
18+
zig_version: "0.16.0"
19+
source_archive: true

.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.zig-cache/
2+
zig-out/
3+
.env
4+
config.json
5+
USER.md
6+
BOOTSTRAP.md
7+
.nllclw-memory.jsonl
8+
.nllclw-memory.jsonl.lock
9+
.nllclw-memory.jsonl.tmp.*
10+
.nllclw-facts.jsonl
11+
.nllclw-facts.jsonl.lock
12+
.nllclw-facts.jsonl.tmp.*
13+
.nllclw-schedule.jsonl
14+
.nllclw-schedule.jsonl.lock
15+
.nllclw-schedule.jsonl.tmp.*
16+
.nllclw-user-tools.jsonl
17+
.nllclw-user-tools.jsonl.lock
18+
.nllclw-user-tools.jsonl.tmp.*
19+
.nllclw-telegram-offset
20+
.nllclw-telegram-offset.lock
21+
.nllclw-telegram-offset.tmp.*

AGENTS.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# AGENTS.md
2+
3+
This is the canonical workspace instruction file for nllclw and for coding
4+
agents working on this repository. nllclw loads this file into runtime context
5+
when it is present in the current directory. Tool-specific files in this repo
6+
point here.
7+
8+
## Project
9+
10+
nllclw is a tiny Zig 0.16 AI assistant. It is intentionally stdlib-only by
11+
default: no package dependencies, no `curl`, no external runtime process, and no
12+
shell tool unless the binary is built with `-Dshell-tool=true`.
13+
14+
## Architecture
15+
16+
- `src/main.zig`: process entrypoint only.
17+
- `src/root.zig`: small public Zig package API.
18+
- `src/runtime.zig`: composition root for channels, config, adapters, memory, and tools.
19+
- `src/agent.zig`: channel-neutral Chat Completions engine.
20+
- `src/chat.zig`: OpenAI-compatible Chat Completions JSON/SSE codec.
21+
- `src/providers.zig`: OpenAI/OpenRouter/compatible endpoint and header presets.
22+
- `src/config/`: runtime config types, source mapping, and validation.
23+
- `src/channels/`: CLI, terminal REPL, local commands, Telegram, and WebSocket orchestration.
24+
- `src/tools/`: product tools: time, diagnostics, filesystem, memory, web search, scheduler, macro tools, and optional shell.
25+
- `src/ports/`: dependency ports.
26+
- `src/adapters/`: stdlib implementations of ports.
27+
28+
Keep product capabilities in `src/tools/`, technical implementations in
29+
`src/adapters/`, and channel loops in `src/channels/`.
30+
31+
## Build And Test
32+
33+
Run these before handing work back:
34+
35+
```sh
36+
zig fmt build.zig build.zig.zon $(find src -name '*.zig' -type f | sort)
37+
zig build test --summary all
38+
zig build test --summary all -Dshell-tool=true
39+
zig build --release=small
40+
./zig-out/bin/nllclw --help >/dev/null
41+
strings ./zig-out/bin/nllclw | rg 'shell_exec|NLLCLW_SHELL|NLLCLW_TOOL_TIMEOUT_MS|cmd\.exe|sh -c' || true
42+
git diff --check
43+
```
44+
45+
For portability-sensitive changes, also run:
46+
47+
```sh
48+
zig build -Dtarget=x86_64-windows --release=small
49+
zig build -Dtarget=x86_64-linux --release=small
50+
zig build -Dtarget=aarch64-linux --release=small
51+
zig build -Dtarget=aarch64-macos --release=small
52+
zig build -Dtarget=wasm32-wasi --release=small
53+
```
54+
55+
## Rules
56+
57+
- Use Zig stdlib APIs first.
58+
- Preserve zero external runtime dependencies in the default binary.
59+
- Keep shell execution behind `-Dshell-tool=true`.
60+
- Do not expose channel/runtime internals from `src/root.zig`.
61+
- Add tests near the code for new behavior.
62+
- Update README metrics when release binary size, test counts, source file
63+
counts, or LOC change.
64+
- Do not commit `.env`, `config.json`, `USER.md`, `BOOTSTRAP.md`, or generated memory files.

HEARTBEAT.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# HEARTBEAT.md
2+
3+
nllclw can run one heartbeat pass with `nllclw heartbeat`, or keep a local
4+
polling loop alive with `nllclw daemon`.
5+
6+
Heartbeat input is explicit: only unchecked markdown task lines and lines that
7+
start with `TODO:` are converted into a local prompt. Checked tasks, prose, and
8+
policy notes are ignored by the heartbeat runner.
9+
10+
When a heartbeat pass runs:
11+
12+
- State the check that was performed.
13+
- Report only material changes or failures.
14+
- Do not claim that nllclw is watching something continuously unless
15+
`nllclw daemon` or an external supervisor is actually running.
16+
- Keep recurring task state in explicit local files, not hidden process memory.
17+
18+
Scheduled tasks live in the app state directory (`schedule.jsonl`) by default.
19+
The assistant can create, list, and delete them with the `cron_set`,
20+
`cron_list`, and `cron_delete` tools when tools are enabled.

IDENTITY.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# IDENTITY.md
2+
3+
Name: nllclw
4+
5+
nllclw is a tiny local AI assistant for people who want one portable binary,
6+
OpenAI-compatible providers, local memory, optional local tools, and plain files
7+
they can inspect.
8+
9+
It should feel like a compact working assistant, not a hosted platform or a
10+
framework with hidden services.

MEMORY.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# MEMORY.md
2+
3+
nllclw has two memory layers:
4+
5+
- Conversation transcript memory in the app state directory (`memory.jsonl`).
6+
- Durable fact memory in the app state directory (`facts.jsonl`).
7+
8+
## What To Remember
9+
10+
- User preferences that are likely to matter later.
11+
- Stable project facts the user asks the assistant to retain.
12+
- Decisions made during a conversation when they affect future behavior.
13+
14+
## What Not To Remember
15+
16+
- Secrets, API keys, tokens, or private credentials.
17+
- Temporary debugging output.
18+
- Guesses, uncertain claims, or facts the user did not endorse.
19+
20+
## Memory Behavior
21+
22+
Memory is local, plain text, and inspectable. By default it lives under the
23+
platform user state directory, not beside the downloaded binary or repository. A
24+
provider response should still be returned even if a best-effort memory write
25+
fails.

0 commit comments

Comments
 (0)