@arthovlabs/liber 0.0.0-stage → 0.5.1

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.
Files changed (60) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +348 -2
  3. package/bin/liber +706 -0
  4. package/bin/liber-tui +244 -0
  5. package/bin/liber-tui.py +825 -0
  6. package/bin/liberd-entry +17 -0
  7. package/liber.yaml +84 -0
  8. package/package.json +43 -4
  9. package/resources/icons/appIcon.png +0 -0
  10. package/resources/icons/appIcon.svg +20 -0
  11. package/resources/icons/appIcon@512.png +0 -0
  12. package/resources/icons/atom-transparent-256.png +0 -0
  13. package/resources/icons/atom-transparent.png +0 -0
  14. package/resources/icons/atom-transparent.svg +19 -0
  15. package/resources/icons/make-atom.js +168 -0
  16. package/src/cli/ui.js +520 -0
  17. package/src/daemon/core/auth.js +217 -0
  18. package/src/daemon/core/automations.js +130 -0
  19. package/src/daemon/core/budget.js +145 -0
  20. package/src/daemon/core/circuit-breaker.js +31 -0
  21. package/src/daemon/core/config-apply.js +223 -0
  22. package/src/daemon/core/connectors.js +131 -0
  23. package/src/daemon/core/engine.js +1029 -0
  24. package/src/daemon/core/evidence.js +306 -0
  25. package/src/daemon/core/executor.js +10 -0
  26. package/src/daemon/core/grounding.js +420 -0
  27. package/src/daemon/core/injection.js +24 -0
  28. package/src/daemon/core/journal.js +81 -0
  29. package/src/daemon/core/liber-soul.js +157 -0
  30. package/src/daemon/core/lock.js +32 -0
  31. package/src/daemon/core/memory.js +106 -0
  32. package/src/daemon/core/model-switch.js +58 -0
  33. package/src/daemon/core/policy.js +102 -0
  34. package/src/daemon/core/providers.js +503 -0
  35. package/src/daemon/core/registry.js +356 -0
  36. package/src/daemon/core/secrets.js +35 -0
  37. package/src/daemon/core/skills.js +264 -0
  38. package/src/daemon/core/tools/browser-tool.js +280 -0
  39. package/src/daemon/core/tools/file-tools.js +277 -0
  40. package/src/daemon/core/tools/memory-tool.js +127 -0
  41. package/src/daemon/core/tools/skill-tool.js +44 -0
  42. package/src/daemon/core/tools/task-tool.js +41 -0
  43. package/src/daemon/core/tools/terminal-tool.js +488 -0
  44. package/src/daemon/core/tools/todo-tool.js +100 -0
  45. package/src/daemon/core/tools/web-tool.js +181 -0
  46. package/src/daemon/core/trace.js +40 -0
  47. package/src/daemon/core/validate.js +105 -0
  48. package/src/daemon/core/vault.js +158 -0
  49. package/src/daemon/core/verifier.js +98 -0
  50. package/src/daemon/core/voice.js +83 -0
  51. package/src/daemon/core/workspace.js +202 -0
  52. package/src/daemon/liberd.js +1343 -0
  53. package/src/daemon/llm/adapters/anthropic-adapter.js +190 -0
  54. package/src/daemon/llm/adapters/gemini-adapter.js +148 -0
  55. package/src/daemon/llm/adapters/ollama-adapter.js +74 -0
  56. package/src/daemon/llm/adapters/openai-adapter.js +148 -0
  57. package/src/daemon/llm/base.js +31 -0
  58. package/src/daemon/llm/manager.js +134 -0
  59. package/src/utils/config-loader.js +109 -0
  60. package/src/utils/logger.js +56 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 June Arthov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,349 @@
1
- # Temporary Holding Version
1
+ # ◢ L I B E R ◣
2
+ > **Minimalist-Utilitarian AI Agent Orchestrator**
3
+ > *An original, self-contained harness — its own cognitive engine, no third-party agent framework.*
4
+
5
+ [![Node.js](https://img.shields.io/badge/Node.js-v20%2B-green.svg)](https://nodejs.org/)
6
+ [![Python](https://img.shields.io/badge/Python-3.10%2B-blue.svg)](https://python.org/)
7
+ [![Architecture](https://img.shields.io/badge/Architecture-Tier--3%20Cognitive-cyan.svg)](#architecture)
8
+ [![License](https://img.shields.io/badge/License-MIT-purple.svg)](LICENSE)
9
+
10
+ ```bash
11
+ npm i -g @arthovlabs/liber
12
+ liber --version
13
+ ```
14
+
15
+ ---
16
+
17
+ ## ⚡ Overview
18
+
19
+ **LiBER** is a high-performance, autonomous AI agent orchestrator designed for precision software engineering, DevOps automation, and multi-step task execution.
20
+
21
+ LiBER is an original codebase — not a fork of, and containing no code from, Hermes Agent (Nous Research) or any other agent framework. It delivers:
22
+ - **Zero-Filler Directness:** High-density technical execution without conversational fluff.
23
+ - **Cognitive Pulse (`[THOUGHT: ...]`)**: Pre-action reasoning before invoking tools.
24
+ - **Tool Suite:** First-class surgical file manipulation, fuzzy patching, command execution, structured planning, and cross-session memory.
25
+ - **Dual Surface:**
26
+ - **LiBER Terminal:** Clean VT100/TrueColor streaming CLI interface.
27
+ - **Tactical Cyber-Obsidian TUI:** Full Textual + Rich reactive telemetry dashboard with Human-In-The-Loop (HITL) safety breakpoints.
28
+ - **Enforced Grounding, Not Requested:** A gate audits every auditable sentence against tool receipts and blocks, repairs, or labels what it cannot verify — the model cannot talk its way past it.
29
+ - **Works While You Don't:** Scheduled automations run prompts through the same engine, gate and policy, each in its own session.
30
+ - **Reach Beyond the Repo:** A headless Chromium the agent drives (open, click, type, screenshot) and HTTP connectors that turn any API into a tool — secrets resolved from the vault at call time, never in the prompt.
31
+ - **Contained by Default:** Commands run in a container (no network, read-only root, workspace-only mount) or, where Docker is absent, PowerShell Constrained Language Mode — with the fallback stated instead of hidden.
32
+ - **Multi-Client by Design:** One token per client with scopes, per-minute rate limits, rotation, and an audit line for every request.
33
+
34
+ ---
35
+
36
+ ## 🛠️ Tool Ecosystem
37
+
38
+ LiBER agents are equipped with a first-class toolset:
39
+
40
+ | Tool | Capability |
41
+ |---|---|
42
+ | `read_file` | Line-numbered reading with offset, limit, and automatic budget truncation |
43
+ | `write_file` | Safe atomic file write with directory auto-creation |
44
+ | `patch` | Surgical code replacement with whitespace-tolerant fuzzy matching & diff preview |
45
+ | `search_files` | Recursive regex content search and file globbing |
46
+ | `terminal` | Host shell execution with timeout and output capture — sandboxed: container by default (no network, read-only root, workspace-only mount), Constrained Language Mode as fallback |
47
+ | `browser` | Real headless Chromium over CDP: `open`, `click` (selector or visible text), `type`, `press`, `extract`, `screenshot`, `eval` — for pages that need JavaScript, a login, or interaction |
48
+ | `fetch_url` | HTTP(S) fetch with HTML→text extraction — ground external claims instead of guessing |
49
+ | `web_search` | Keyless web search (DuckDuckGo → SearXNG fallback) returning titles/URLs/snippets |
50
+ | `vault` | AES-256-GCM secret store: list (names + last-4 only), set, remove; reading a value back into a prompt is opt-in |
51
+ | `conn_<id>` | One tool per declared HTTP connector, generated from `.liber/connectors.json`; `vault:name` headers resolve at call time |
52
+ | `task` / `tasks` | Subagent orchestration: one isolated child turn, or up to 4 in parallel |
53
+ | `todo_list` | Structured multi-step task planning and dependency tracking |
54
+ | `memory` | Persistent cross-session knowledge bank (`.liber_memory.json`) |
55
+
56
+ ---
57
+
58
+ ## 🚀 Quick Start
59
+
60
+ ### Install from npm
61
+
62
+ ```bash
63
+ npm i -g @arthovlabs/liber
64
+ liber --version
65
+ ```
66
+
67
+ Both commands are installed: `liber` (CLI / TUI) and `liberd` (daemon).
68
+
69
+ ### Or from source
70
+
71
+ ```bash
72
+ git clone https://github.com/june-arthov/LiBER-.git
73
+ cd LiBER-
74
+ npm install
75
+ npm link
76
+ ```
77
+
78
+ > **Linux/WSL: use the full setup script** — it handles the pieces `npm link`
79
+ > needs sudo for, creates an isolated `.venv` for the Python TUI (textual + httpx),
80
+ > and copies `.env` from the template:
81
+ >
82
+ > ```bash
83
+ > bash scripts/setup.sh
84
+ > ```
85
+ >
86
+ > Manual fallback: `sudo npm link` (or run `node bin/liber` without linking) and
87
+ > `python3 -m pip install --user textual httpx` for the TUI.
88
+
89
+ *(Optional Python TUI dependencies)*
90
+ ```bash
91
+ pip install rich textual httpx
92
+ ```
93
+
94
+ ### 2. Configuration
95
+
96
+ Create your local `.env`:
97
+ ```bash
98
+ cp .env.example .env
99
+ ```
100
+ Add your API key (e.g. Ollama Cloud or OpenAI compatible):
101
+ ```env
102
+ OLLAMA_CLOUD_API_KEY=your_key_here
103
+ ```
104
+
105
+ ### 3. Usage
106
+
107
+ #### Start the Background Daemon
108
+ ```powershell
109
+ liber spawn
110
+ ```
111
+
112
+ #### Launch Interactive LiBER Terminal
113
+ ```powershell
114
+ liber
115
+ ```
116
+ *Available slash commands inside the terminal: `/help`, `/status`, `/tools`, `/model`, `/logs`, `/clear`, `/tui`, `/exit`.*
117
+
118
+ #### Launch Tactical Cyber-Obsidian TUI Dashboard
119
+ ```powershell
120
+ liber tui
121
+ ```
122
+ *Or directly via Python:*
123
+ ```powershell
124
+ python bin/liber-tui.py
125
+ ```
126
+
127
+ #### One-Shot CLI Execution
128
+ ```powershell
129
+ liber chat dev-bot "audit project directory and verify package.json"
130
+ ```
131
+
132
+ #### Manage Fleet
133
+ ```powershell
134
+ liber ps # Check agent fleet status and uptime
135
+ liber logs -n 25 # View structured telemetry stream
136
+ liber skills # List procedural skills (liber skills <name> to print one)
137
+ liber resume # Continue an interrupted turn from .liber/turns/
138
+ liber reset # Clear the persisted conversation window
139
+ liber bench # Run the 8-case model-compliance benchmark (grounded, honesty, tools)
140
+ liber desktop # Launch the LiBER desktop shell (LiBER.exe — OpenCode-style UI)
141
+ liber stop # Gracefully shutdown daemon
142
+ ```
143
+
144
+ ---
145
+
146
+ ## 🧿 Zero-Hallucination Protocol
147
+
148
+ Prompt wording alone cannot stop a model from inventing claims, so LiBER enforces grounding
149
+ mechanically on every turn:
150
+
151
+ 1. **Evidence ledger** — every tool result becomes a numbered receipt (`E1`, `E2`, …) with tool,
152
+ arguments, exit code, output hash and excerpt. The ledger is injected into the system prompt.
153
+ 2. **Grounding gate** — before any answer is returned, `src/daemon/core/grounding.js` audits every
154
+ auditable sentence (file paths, commands, test results, versions, dates, "I did X" claims).
155
+ Each must cite a receipt that exists in this turn's ledger.
156
+ 3. **Repair loop** — a failing answer is blocked and sent back with its exact violations. The model
157
+ must gather the missing receipts or write the claim as `UNVERIFIED: …`. After `max_repairs`
158
+ (default 2) the answer ships with a visible `GROUNDING AUDIT` footer naming every unproven claim.
159
+ 4. **Read-back enforcement** — `write_file` / `patch` put the file into a pending-verification set;
160
+ success cannot be claimed until the file is read back or a test/build runs green.
161
+ 5. **Argument validation** — tool calls are validated against their schema before execution;
162
+ missing, typo'd or ill-typed arguments are rejected and fed back, never executed.
163
+ 6. **Semantic verifier** — after the syntactic gate passes, a second pass asks whether the cited
164
+ receipt actually *entails* each claim. Unsupported claims are sent back for repair.
165
+ 7. **Skills** — a real procedural library: `skills/<name>/SKILL.md` (global) and
166
+ `.liber/skills/` (per project). The prompt carries a cheap index plus the always-on core
167
+ procedures; the model loads a body with the `skill` tool, and matching triggers auto-select
168
+ one for the task. Inspect with `liber skills [name]`.
169
+
170
+ **What it guarantees:** no unverified claim is delivered as verified fact — every auditable claim
171
+ is bound to a real receipt or explicitly labelled UNVERIFIED, and a second model pass checks whether
172
+ the cited receipt actually entails it. It is still not a proof system: the semantic verifier can miss
173
+ subtle unsupported claims or flag supported ones, and a verifier outage fails open (recorded as
174
+ `semantic: error`, never silently as `pass`).
175
+
176
+ Run the enforcement suite with `npm test` (242 tests: a scripted model that hallucinates, gets
177
+ blocked, and is forced to read the file before answering; a 15-case grounding regression dataset;
178
+ the terminal policy incl. per-stage pipeline evaluation; the approval-channel wiring; the budget
179
+ guard; and the git/workspace surface). CI runs the suite on Linux and Windows via
180
+ `.github/workflows/ci.yml`.
181
+
182
+ ## 🔌 Providers
183
+
184
+ Liber talks to any provider through one of four adapters. The key goes in `.env`
185
+ (or your shell environment) — never in `liber.yaml`.
186
+
187
+ | Adapter | Provider(s) | `provider` | `endpoint` | Key env var |
188
+ |---|---|---|---|---|
189
+ | OpenAI-compatible | OpenAI, Groq, Mistral, DeepSeek, OpenRouter, xAI, Together, Ollama Cloud | `openai` | e.g. `https://api.openai.com/v1` | `OPENAI_API_KEY` (falls back to `OLLAMA_CLOUD_API_KEY`) |
190
+ | Anthropic | Claude models | `anthropic` | `https://api.anthropic.com` | `ANTHROPIC_API_KEY` |
191
+ | Google | Gemini models | `gemini` | `https://generativelanguage.googleapis.com` | `GEMINI_API_KEY` (falls back to `GOOGLE_API_KEY`) |
192
+ | Ollama native | local Ollama servers | `ollama` | e.g. `http://localhost:11434` | none required |
193
+
194
+ Details:
195
+
196
+ - **OpenAI-compatible** covers every provider that speaks `/chat/completions`. Change
197
+ `engine.provider`, `engine.endpoint`, `engine.model` and the key — nothing else.
198
+ - **Anthropic** is a dedicated adapter: system messages move to the `system` parameter,
199
+ consecutive same-role turns are merged (the Messages API rejects repeats), and native
200
+ tool calling is translated both ways (`tool_calls` ↔ `tool_use`/`tool_result`).
201
+ - **Gemini** translates roles into `contents`/`systemInstruction` and streams via
202
+ `streamGenerateContent?alt=sse`. Native tool calling is not implemented — the engine
203
+ falls back to the text protocol automatically.
204
+ - **Streaming** works on all adapters; a failed stream always falls back to a full,
205
+ audited completion.
206
+
207
+ ## 🖥️ Desktop Shell (LiBER.exe)
208
+
209
+ An original Neutralino/WebView2 shell (~3 MB, no Electron) with an OpenCode-style
210
+ interface: left sidebar shows the real agent fleet and a live model picker
211
+ (`/model/switch`), the main pane streams the turn over SSE (reasoning, tool
212
+ receipts, grounding audit, cited answers), and the input bar is keyboard-first
213
+ (Enter send, Ctrl+M model, Ctrl+L clear).
214
+
215
+ Build once:
216
+
217
+ ```bash
218
+ cd desktop
219
+ npm i -D @neutralinojs/neu
220
+ npx neu update
221
+ npx neu build
222
+ ```
223
+
224
+ The binary lands at `desktop/dist/liber-desktop/LiBER.exe` — double-click it or
225
+ run `liber desktop`. It talks to the local daemon (`127.0.0.1:4567`): the daemon's
226
+ unauthenticated `GET /whoami` reports only the token **file path** (never the
227
+ token), the shell reads the file through the Neutralino filesystem API, and all
228
+ stateful calls keep the bearer token. The daemon also gained CORS headers and an
229
+ OPTIONS handler so local shells can call it without weakening auth.
230
+
231
+ ## 📚 Skill Library
232
+
233
+ Skills are procedures, not prompt text: each one is a `SKILL.md` with a one-line "use when"
234
+ description, optional triggers, and a body. They are discovered at boot, indexed cheaply, and
235
+ loaded only when needed.
236
+
237
+ - **Global** — `skills/<name>/SKILL.md` (shipped with Liber).
238
+ - **Project** — `.liber/skills/<name>/SKILL.md` (overrides a global skill of the same name).
239
+ - **On demand** — `[TOOL: skill({"action":"view","name":"..."})]`; `list` / `search` also available.
240
+ - **Auto-select** — a trigger match injects the body for that turn.
241
+ - **Authoring** — `skill` action `create`/`update` writes to `.liber/skills/` and requires HITL approval.
242
+ - **Attachments** — `references/`, `scripts/`, `templates/` next to `SKILL.md` are listed by `view`.
243
+
244
+ Shipped skills: `iron-law` (always), `grounding-protocol` (always), `systematic-debugging`,
245
+ `verification-first`, `surgical-precision`, `honest-refusal`, `instruction-fidelity`,
246
+ `codebase-orientation`, `performance-triage`.
247
+
248
+ ## ⚙️ Harness Capabilities
249
+
250
+ | Capability | Behaviour |
251
+ |---|---|
252
+ | Daemon auth | Every endpoint except `/healthz` needs a bearer token, resolved to a client with scopes (`read`, `chat`, `tools`, `admin`), a per-minute token bucket (429 + `Retry-After`) and one audit line per request in `.liber/auth-audit.log`. The desktop token in `.liber/daemon.token` is adopted as the `local` admin client; other clients get their own once-only token from `/clients`, and can be rotated or revoked without touching anyone else. |
253
+ | Command sandbox | `policy.terminal.backend` selects the execution surface: `docker` runs in a container (no network, read-only root, `--cap-drop ALL`, `no-new-privileges`, memory/pids caps, only the workspace mounted) and `powershell` runs in Constrained Language Mode with a scrubbed environment. Docker unreachable means a stated fallback, never a silent one. Every decision and run is appended to `.liber/terminal-audit.log`. |
254
+ | Secret vault | AES-256-GCM at rest (`.liber/vault.json`, key `0600`), listing exposes only the last four characters, tampered ciphertext fails closed, and connectors reference secrets as `vault:name` so they are resolved at call time. |
255
+ | Automations | Interval or daily-at jobs stored in `.liber/automations.json`, run by one daemon timer through the same engine, gate and policy; `markRun()` makes a tick idempotent and a running job is never started twice. |
256
+ | Turn serialization | One turn at a time per agent — simultaneous chats queue instead of interleaving observations into each other's context. |
257
+ | Deterministic receipt checks | A cited receipt must actually mention the file and contain the numbers, quoted strings and line numbers claimed — enforced by code, no model involved. |
258
+ | Secret redaction | Credential-shaped text (API keys, PATs, Bearer tokens, private keys) is redacted before session, journal and trace data reach disk. |
259
+ | Injection defense | `fetch_url` output is wrapped in an `UNTRUSTED` marker, instruction-like tool output is flagged and labelled DATA ONLY, and the doctrine forbids obeying content. |
260
+ | Write policy | `write_file` / `patch` are confined to `policy.write_roots`. The terminal has its own policy: `read_only` blocks state-changing commands (with an allowlist), `allowlist` restricts to listed prefixes, `prompt` keeps HITL only. Read-only inventory commands (`ls`, `dir`, `Get-ChildItem`, `cat`, `git log`, …) are allowed in every mode, pipelines are judged stage by stage, and redirection (`>`, `>>`, `<`) or command substitution (`$( )`, backticks) is always refused — no prefix entry can cover it. A denial names the allowed prefixes so the agent can adapt instead of retrying. |
261
+ | Native tool calling | `engine.native_tools: true` uses the provider's tool API with canonical assistant/tool messages; falls back to the text protocol if the provider rejects it. |
262
+ | Budget guard | `limits.max_tokens_per_day` and (when prices are set) `max_cost_per_day` are enforced before every model call; state in `.liber/budget.json`. |
263
+ | Settings API | `GET /config` (sanitized) and `POST /config` (whitelisted keys) let the desktop shell read and change engine, grounding, terminal policy, limits, memory and telemetry settings live, persisted to `liber.yaml` with comments intact. `POST /model/switch` and `POST /config/backup` are covered too. |
264
+ | Settings parity | The desktop drawer mirrors a full settings tree (Model, Chat, Appearance, Workspace, Safety, Browser, Passwords, Memory, Voice, Advanced, Notifications, Billing, Providers, Gateways, Shortcuts, Tools, Sessions, About) with subpages, search and Export / Reset. Panels without a daemon backend say so instead of faking a save. |
265
+ | Providers API | `GET /providers` (catalog of 40 providers + configured state with last-4 hints), `POST /providers/key`, `/providers/clear`, `/providers/custom`, `/providers/test` (live model-list probe) and `/providers/import` (subscription tokens already stored by Claude Code, Gemini CLI, Codex, Qwen, gh). Credentials live in `.liber/credentials.json` (0600) and are never returned to a client. |
266
+ | Workspace API | `GET /workspace` returns the real cwd, git branch, changed files with `+/-` line counts (from `git status` + `git diff --numstat`) and the tool steps this daemon actually executed. `GET /skills` lists installed skills; `POST /compact` summarizes history with the active model (falls back to trim); `POST /revert` drops the last exchange. |
267
+ | Subagents | `task` runs one isolated child turn; `tasks` runs up to 4 in parallel. Children get their own ledger, read-only tools, no recursion, and return a cited report as a receipt. |
268
+ | Resume | The turn journal (`.liber/turns/`) is written every iteration; after a crash `liber resume` continues from the last completed iteration with its receipts intact. |
269
+ | Live reasoning | Each model turn's reasoning is captured — tagged `[THOUGHT: …]` or untagged prose before a tool call — and streamed to the CLI/TUI as a `REASONING` block before the answer. |
270
+ | Draft streaming | With `engine.stream: true`, raw model output types out live in a `DRAFT · UNVERIFIED` line while the answer is still being generated. The audited answer replaces it; a partial stream is discarded and regenerated. Token usage is preserved via `stream_options.include_usage`. |
271
+ | Streaming CLI | `liber` and `liber chat` consume `/chat/stream`, so reasoning, tool calls and observations appear as they happen instead of only at the end. |
272
+ | Retry with backoff | 429/5xx/timeout are retried up to `retry_attempts` (default 3); auth/4xx errors are never retried. |
273
+ | Session persistence | The conversation window survives daemon restarts in `.liber/session.json` (`liber reset` clears it). |
274
+ | Trace audit | Every completed turn appends one JSONL record to `.liber/traces/YYYY-MM-DD.jsonl`. |
275
+ | Real usage | Provider `usage` is reported per turn; `cost_estimate` appears only when prices are configured. |
276
+ | Loop guard | Identical repeated tool calls are suppressed after two attempts and the model is forced to answer or declare the gap. |
277
+
278
+ ## 🛡️ Human-In-The-Loop (HITL) Safety
279
+
280
+ LiBER automatically intercepts sensitive or destructive operations:
281
+ - File mutations (`write_file`, `patch`)
282
+ - Destructive commands (`rm -rf`, `format`, `del /s`, force push, drop table)
283
+
284
+ When intercepted, execution pauses and alerts the operator:
285
+ - **`[A]`**: Approve execution
286
+ - **`[D]`**: Deny execution and prompt agent to adapt
287
+
288
+ ### Where commands actually run
289
+
290
+ `policy.terminal.backend` picks the execution surface, and the gate is enforced by
291
+ the machine rather than by the prompt:
292
+
293
+ | backend | isolation | what it means |
294
+ | --- | --- | --- |
295
+ | `docker` | container | no network, read-only root filesystem, dropped capabilities, `no-new-privileges`, memory and pid caps, and **only the workspace** mounted (at `/work`, read-write). The Windows filesystem, browser profile and SSH keys are not reachable. |
296
+ | `powershell` | language mode | same machine, but PowerShell runs in **Constrained Language Mode**, which refuses `[System.IO.File]`, `Add-Type` and reflection; the child gets a scrubbed environment so provider keys are not inherited. |
297
+
298
+ Every decision and every run is appended to `.liber/terminal-audit.log`, and
299
+ `GET /sandbox` reports which surfaces are actually available on this machine.
300
+ Docker Desktop must be running for the container backend; when it is not, LiBER
301
+ falls back to Constrained Language Mode and says so instead of pretending.
302
+
303
+ ---
304
+
305
+ ## 🔑 Clients and tokens
306
+
307
+ Each client gets its own token, scopes (`read`, `chat`, `tools`, `admin`) and a
308
+ per-minute rate limit. Tokens are stored as SHA-256 only, shown once at creation,
309
+ and can be rotated or revoked without touching other clients. Every request is
310
+ appended to `.liber/auth-audit.log` with the client id, scope, status and
311
+ duration. Manage them in **Settings → Access & Tokens** (`GET/POST/DELETE
312
+ /clients`, `POST /clients/rotate`).
313
+
314
+ ---
315
+
316
+ ## 🔐 Secrets
317
+
318
+ Provider keys and tokens live in an AES-256-GCM vault (`.liber/vault.json`, key at
319
+ `.liber/vault.key`, `0600`); listings expose only the last four characters, a
320
+ tampered ciphertext fails closed, and connectors may reference a secret as
321
+ `vault:name` so it is resolved at call time and never enters a prompt.
322
+
323
+ ---
324
+
325
+ ## 📄 Architecture
326
+
327
+ ```text
328
+ [Operator Interface]
329
+ ├─ LiBER Terminal (CLI REPL)
330
+ └─ Cyber-Obsidian Dashboard (Textual TUI)
331
+ │
332
+ │ HTTP / Server-Sent Events (SSE)
333
+ ▼
334
+ [Liber Daemon (liberd)]
335
+ ├─ Liber Engine (Autonomous Turn Loop)
336
+ ├─ Cognitive Pulse (Reasoning Parser)
337
+ ├─ Tool Registry (file, terminal, todo, memory)
338
+ ├─ Circuit Breaker & Self-Healing Guard
339
+ └─ Context Compressor (Sliding Window & Semantic Summary)
340
+ │
341
+ ▼
342
+ [LLM Gateway / Model Provider] (Ollama Cloud, OpenAI, Custom)
343
+ ```
344
+
345
+ ---
346
+
347
+ ## 📜 License
348
+ MIT © 2026 June Arthov
2
349
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.