Skip to content

Commit 70ee12e

Browse files
Null-aiDonPrus
authored andcommitted
Initial commit
0 parents  commit 70ee12e

236 files changed

Lines changed: 54369 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.

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.git
2+
.github
3+
.zig-cache
4+
zig-out

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.sh text eol=lf
2+
*.zig text eol=lf
3+
*.zon text eol=lf

.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/scripts/ci.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
zig fmt --check build.zig build.zig.zon src
5+
zig build test --summary all
6+
zig build test --summary all -Dshell-tool=true
7+
zig build --release=small
8+
9+
case "$(uname -s)" in
10+
MINGW*|MSYS*|CYGWIN*)
11+
bin="./zig-out/bin/nllclw.exe"
12+
;;
13+
*)
14+
bin="./zig-out/bin/nllclw"
15+
;;
16+
esac
17+
"${bin}" --help >/dev/null
18+
19+
if command -v strings >/dev/null 2>&1; then
20+
shell_markers='shell_exec|NLLCLW_SHELL|NLLCLW_TOOL_TIMEOUT_MS'
21+
case "$(uname -s)" in
22+
MINGW*|MSYS*|CYGWIN*)
23+
;;
24+
*)
25+
shell_markers="${shell_markers}|cmd\\.exe|sh -c"
26+
;;
27+
esac
28+
if strings "${bin}" | grep -E "${shell_markers}"; then
29+
echo "default binary contains shell-only strings"
30+
exit 1
31+
fi
32+
else
33+
echo "strings is not available; skipping shell-only string scan"
34+
fi
35+
36+
zig build --release=small -Dshell-tool=true
37+
zig build -Dtarget=x86_64-windows --release=small
38+
zig build -Dtarget=x86_64-linux --release=small
39+
zig build -Dtarget=aarch64-linux --release=small
40+
zig build -Dtarget=aarch64-macos --release=small
41+
zig build -Dtarget=wasm32-wasi --release=small

.github/workflows/ci.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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: bash .github/scripts/ci.sh

.github/workflows/release.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ["v20*"]
6+
7+
permissions:
8+
contents: write
9+
packages: write
10+
11+
jobs:
12+
release:
13+
uses: nullclaw/nullbuilder/.github/workflows/zig-release.yml@v1
14+
permissions:
15+
contents: write
16+
packages: write
17+
with:
18+
binary_name: nllclw
19+
artifact_prefix: nllclw
20+
zig_version: "0.16.0"
21+
source_archive: true
22+
publish_docker: 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: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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+
- When changing English documentation under `docs/en/`, apply the equivalent
65+
documentation update to every translated language directory under `docs/`.
66+
- Do not commit `.env`, `config.json`, `USER.md`, `BOOTSTRAP.md`, or generated memory files.

CODE_OF_CONDUCT.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Code of Conduct
2+
3+
## Scope
4+
5+
This code of conduct applies to the `nllclw` repository, issues, pull requests,
6+
reviews, discussions, and any maintainer-run project spaces.
7+
8+
## Expected Behavior
9+
10+
- Be respectful and direct.
11+
- Focus criticism on code, documentation, behavior, and tradeoffs.
12+
- Assume good intent when reasonable, and ask for clarification when something
13+
is ambiguous.
14+
- Keep discussions relevant to the project and its users.
15+
- Protect private information, credentials, logs, tokens, and security reports.
16+
17+
## Unacceptable Behavior
18+
19+
- Harassment, threats, personal attacks, or sustained disruption.
20+
- Discriminatory language or behavior.
21+
- Publishing private information without explicit permission.
22+
- Sexualized comments or imagery in project spaces.
23+
- Deliberately misleading reports, malicious code, or attempts to bypass project
24+
safety boundaries.
25+
26+
## Enforcement
27+
28+
Maintainers may remove comments, close issues, reject contributions, or restrict
29+
repository access when behavior violates this code of conduct.
30+
31+
If you need to report a conduct issue, contact a maintainer privately through
32+
GitHub. Include the relevant links, screenshots, or context needed to evaluate
33+
the report. Do not publish private or sensitive information in a public issue.

0 commit comments

Comments
 (0)