# Learnitive 2.0 — Autonomous State — Vibe Coding R1

The current source state is the 2026-09-05 Vibe Coding R1 checkpoint candidate derived from Hotfix34. The durable detailed state is in `docs/learnitive-vibe-coding-state.md`.

## Current product direction

Learnitive is a local-first browser IDE with an optional secure server development environment and AI Agent. Traditional project creation is preserved. A signed-in user has one disposable Docker development container containing separate `/workspace/projects/<project-id>` working trees. Free sandbox lifetime is 24 hours; Pro is 7 days. Missing containers reconstruct automatically with a fresh generation/lifetime when a project is accessed.

Terminal, Agent commands, build/test, tracked processes and dynamic Preview all use the same active project working tree. Durable source remains local and project-level synchronization reconciles browser/local storage with the disposable sandbox.

Project authorization is centralized around owner/editor/viewer roles and `private`, `shared`, `authenticated_public`. Share links require authentication. Published/project Preview access is not anonymous. Collaboration participants require authenticated signed grants.

AI uses the existing provider and project AI stack. Ask remains review-oriented; Agent adds real sandbox verification, bounded repair, platform checkpoints and Undo. Build with AI is additive to normal New Project.

## Verification

- supported server/static: 345/345 PASS;
- project runtime: 10/10 PASS;
- vibe invariants: 6/6 PASS (included above);
- capability audit: 30/30 PASS;
- lock sync: PASS (69 / 1581 / 1583 / 1171);
- trusted runtime manifest: PASS (9 imports);
- R12 release audit: PASS;
- Learnitive brand audit: PASS, 0 violations;
- provenance audit: PASS;
- installer/server/gateway syntax: PASS;
- modified frontend TypeScript syntax parse: 14/14 files PASS.

## Staging-only acceptance

The current execution environment cannot run the production browser build because project dependencies are absent and npm registry DNS is unavailable. Docker is also unavailable. Staging must therefore run the build, migration v36, Docker sandbox/reconstruction/PTY/process/Preview acceptance, authenticated multi-user share/collaboration tests, 69-template validation and Learn acceptance. Vite HMR WebSocket proxying remains a known follow-up; HTTP Preview works by design and static Preview remains the fallback.

## Protected infrastructure

Staging only: `https://os.learnitive.com`, `/var/www/os.learnitive.com`, `/etc/learnitive`. Do not modify `/etc/texise/*`, TeXise vhosts/services/data, or unrelated Apache/systemd infrastructure.

## 2026-09-05 — Vibe Coding R4: persistent Agent state + canonical runtime settings

Baseline: R3 Agent Runtime Tools / Process Registry.

Implemented migration v38 with project_ai_threads, project_ai_messages, project_ai_tasks, project_ai_tool_actions and project_runtime_settings. User-visible Ask/Agent messages and bounded Agent task states are now persisted server-side; tool actions persist only safe summaries and never hidden reasoning or raw command output. Empty browser-local AI history can hydrate from project server history after refresh. Agent tasks record planning/running/waiting_for_tool/verifying/completed/failed/cancelled state and audit terminal outcomes.

Project runtime settings now provide optional runtime mode, working directory, build/start/test commands and Preview port. The configured relative working directory is path-normalized server-side and propagated through the trusted Console Gateway to real one-shot commands and long-running processes. Agent build/test/start heuristics use project settings first. Project Manage UI exposes runtime settings and share-link expiry choices (none/1h/24h/7d).

Verification: 351/351 broad server/static tests PASS; 10/10 project-runtime PASS; migration tests 15/15 PASS; capability audit 32/32 with 0 blockers; lock sync, trusted runtime manifest, R12 release audit, Learnitive brand audit, TeXise provenance audit, installer syntax and server/Console Gateway syntax all PASS.

Remaining high-priority work: Preview HMR WebSocket proxy + dedicated-origin hardening; project-delete/runtime cleanup; active long-lived permission revocation; hard quota deployment/staging validation; resource observability/accounting; provider-native streaming/Auto routing; Community/Explore/Fork/Publish Snapshot; guarded stale CMS documentation migration; full browser/Docker/staging acceptance.


## 2026-09-05 — Vibe Coding R8
Current schema is through v41. Migration v40 performs guarded canonical documentation/security wording updates; migration v41 adds low-volume account runtime usage accounting and signed-in usage UI. Current exact-tree verification is 354/354 broad Node tests, 10/10 runtime, capability 37/37, repository TypeScript syntax 207/207, with lock/trusted/R12/branding/provenance/installer/server gates green. Core architecture now also includes the R5 HMR/lifecycle security work, R6 observability/native streaming/Auto routing, and R7 explicit publication snapshots/Explore/Fork. Staging still must perform the locked browser build, actual Docker/quota/PTy/process/HMR/origin, migrations, templates, Learn and Apache acceptance.

## R9 isolated Preview / environment reset milestone — 2026-09-05
Learnitive now supports an optional Preview-only origin authenticated by short-lived viewer/project/process/generation tickets and a scoped HttpOnly Preview cookie. Main app credentials are not delegated to project code. Dynamic Preview HMR follows the same authorization boundary. Restart and Reset are explicitly distinct: Restart recreates the container generation while preserving the mounted disposable workspace; Reset destroys disposable runtime state and durable local source is re-materialized through local-first synchronization. Dynamic Preview browser console/runtime/resource/fetch diagnostics are surfaced to the IDE and Agent `inspect_preview`.

## R10 canonical Preview hostname correction — 2026-09-05

The isolated untrusted application Preview origin is canonically `https://preview.learnitive.com`. The staging application remains `https://os.learnitive.com`. Apache Preview vhost names, certificate paths, installer detection, CSP allowlists, Preview-origin tests and capability audits use the canonical Preview hostname.

## R11 staging Console readiness fix — 2026-09-05

The Console Gateway now exposes canonical `/healthz` and backward-compatible `/health`. The staging installer probes `/healthz`, removing the readiness timeout seen when systemd reported the gateway as healthy and listening. The installer also stages external font files before Vite compilation so `/learnitive-fonts/*` resolves at build time, cleans the temporary staging files afterwards, and uses portable `cp --no-clobber` semantics.

Exact available verification: 363/363 broad tests, 10/10 runtime, 11/11 vibe invariants, capability 40/40, lock/trusted/R12/brand/provenance/installer/server checks PASS.
