Cortex UI
Status: Ready
Truth label: Current
Audience: Fleet operator
Reader outcome: Know how Cortex runs, is structured, navigates, keeps browser state, and behaves on each tab.
Last verified: 2026-09-13
Cortex is the static browser interface for AGENTASIAN. The current repository
contains one Cortex implementation under cortex-ui/. The former Python and
Gradio cortex/ application is not present.
Runtime
Cortex is served as static files, normally on port 3000:
python -m http.server --directory cortex-ui --bind 127.0.0.1 3000
The standard run-all launchers start it with Brain on port 8081 and Forge on
port 8080.
The browser derives both API URLs from its own hostname:
http://<cortex-host>:8080
http://<cortex-host>:8081
It does not provide a settings control for different API hostnames or HTTPS origins.
Structure
cortex-ui/
index.html
src/
api.js
main.js
styles/main.css
There is no build step or package manager. index.html loads the JavaScript
module and the marked and DOMPurify browser libraries.
Navigation
| Tab | Service | Main functions |
|---|---|---|
| Chat | Brain | Streaming response, composer and expandable Chat settings. The line under the composer reports the selected model, voice, lens, mode, sources and polish |
| Settings | Browser, Brain and Forge | Saved defaults, models and budgets; operating files and resources; theme, density and the browser API token |
| Memory | Brain | Search, add, ingest, inspect, edit, and delete collection documents |
| Overview | Forge | Waiting on you, running now, recent failures, fleet, task history and schedules. Tasks and Checkpoints were folded in here by the Forge information architecture rework |
| Projects | Forge | Create, edit, and delete projects; view sessions and schedules |
| Rules | Brain | Create, edit, enable, order, and delete rules |
| Analytics | Brain and Forge | Headline figures and charts over egress, outcome grading, stage summaries, retrieval lift, and learning candidates |
Manage Cortex, in the sidebar, Settings and on Ctrl/Cmd-K, searches the existing editors and work views.
The shell
Three columns: a rail, the workspace, and an inspector.
The rail cycles through expanded, icons and hidden with the sidebar button or
[. Between 700px and 1100px it presents as icons whatever the stored state,
and below 700px it overlays the workspace.
Run detail uses the third column so a run can be read beside the list it was
opened from. Above 1100px it is docked and can be dragged wider; below, it
becomes an overlay sheet. The inspector button and ] act only when a panel
exists. Chat settings expand beside the composer on Chat only. They never occupy the shared inspector.
The fragment carries the tab and the open run: #tab=overview&run=a3f7e21f.
Back, forward and a pasted link all work. #manage=<id> is unchanged and is
still owned by the management menu.
Density switches row heights and spacing between comfortable and compact from Settings > Cortex preferences, alongside the theme. Both are remembered per browser.
Worker state is rendered through Forge data. Session and schedule controls are part of the project and task workflows rather than separate top-level tabs.
Settings
Open Settings in the sidebar. The direct URL is #tab=settings.
- Defaults, models and budgets: Open the existing versioned editors. Saving defaults leaves current conversation choices intact; applying saved defaults remains an explicit action.
- Operating instructions: Open the host and project file inventory, with character counts, limits, validation, hashes and history.
- Cortex preferences: Theme, density and the API token stored by this browser.
Open Chat settings directly above the composer to expand the current prompt controls without leaving Chat. Controls wait for discovery and saved settings to finish loading before accepting edits. Collapse the panel to keep writing; the unsent message and selected values stay intact. The summary below the composer shows the current model and writing controls.
Change these controls before each prompt. Send and Queue retain the selected settings for that prompt, so later changes do not alter queued requests. Prompts queued during initial loading use the resolved startup settings. Shared defaults and operating configuration remain in Settings.
Clear, save, load and note actions stay above Chat. Task and reply evidence remains available on the
corresponding result. Manage Cortex and existing #manage= links still reach
the same editors. #tab=settings&manage=chat-defaults-btn opens one over
Settings; closing it removes only the manage part of the URL.
Browser state
Cortex stores these values in local storage:
- fleet API bearer
- current conversation UUID
- current local chat history
- reasoning-lens selection
- voice-register selection
Clearing browser storage removes this state but does not delete server-side conversations, knowledge, tasks, or rules.
The fleet bearer is readable by scripts running in the Cortex origin. Use a trusted browser profile and do not share the origin with unrelated content.
Chat behavior
At startup, Cortex loads:
- available providers and models
- provider generation-control support
- reasoning lenses and voice registers
- approved voice examples and library state where needed
It sends POST /chat/stream and consumes server-sent events. Intermediate
events can report retrieval and tool activity. The done event is the
authoritative response.
Response rendering uses:
- marked for Markdown parsing
- DOMPurify for HTML sanitization
- a plain-text fallback when either library is unavailable
External marked and DOMPurify resources have subresource-integrity attributes. The checked-in static server does not add a content security policy.
Generation controls
Cortex exposes the controls that Brain reports for the selected provider. It supports separate reasoning-lens and voice-register selection, optional voice polish, and supported sampling settings.
The UI disables or clears incompatible controls, but Brain remains the authoritative validator.
Memory behavior
Memory views work with Brain collections such as:
- learnings
- knowledge
- conversations
- notes
- voice examples
The ingestion form sends a server-side file or directory path. It is not a browser file upload. Brain must be able to read the path on its own host.
Direct document browse and CRUD views do not currently apply client-scope filtering. Treat them as operator-only.
Project behavior
Cortex can create and update common project fields, including name, path, description, repository URL, status, and supervision mode where presented.
Current gap: its project API client does not send client_id or shared.
Administer confidentiality scope through the Forge API until the UI is updated.
Task behavior
The task form supports core execution settings, including project, title, description, provider, model, engine, permission, retry, worker persona, skills, and related controls present in the current form.
The task list and detail views display state, output, errors, verification, changed files, run metadata, logs, dependencies, and session context as available.
Every dispatched run is asked to end its report with pull-request text under a
## PR description heading, and the prompt restates that requirement as its
last line so the repository's own rules about changelog entries do not become
the last thing the agent reads. When it does, the worker lifts that section into
run metadata and the detail view shows it above the full result, as written
rather than rendered, with its own copy button. A run that wrote none shows no
PR block.
The fleet panel lists each worker's engines with the version that engine's CLI reported at registration. Hover a row for the full version strings, including any engine whose CLI would not answer.
Checkpoint behavior
The Checkpoints tab lists tasks in checkpoint state and supports:
- approval
- optional 1 through 5 grade
- operator note
- revise with feedback
- fail
- at a plan checkpoint, approve and complete the task without the execution stage
Current gap: approval does not send override_gate. Accepting a structurally
unpassable failure gate requires a direct Forge API request.
Analytics behavior
Cortex presents:
- provider egress and reported cost
- task and chat activity
- checkpoint decisions and mean grades
- results by pipeline stage
- observational retrieval outcome lift
- learning candidates and source scope
- promote and dismiss actions
Outcome lift is correlational. The current backend also counts QA-gate metadata as retrieval evidence, so use the comparison directionally.
Promotion requires an operator-authored generalized summary and explicit acknowledgment that no client deliverable was copied.
Authentication behavior
When either API returns 401, Cortex raises an authentication-required event and prompts for the fleet bearer. Requests then use:
Authorization: Bearer <token>
Cortex has no per-user session, role, or client login. The bearer grants the same perimeter access to every protected route. See the security model.
Client-scope limitations
Cortex does not yet provide:
- project client-id and shared controls
- a chat scope selector
- a visible all-scope operator flow
- a run-token-bound worker retrieval view
Do not use the current UI as proof that client boundaries are enforced.
Development and verification
Cortex source has no compilation step. CI verifies JavaScript syntax with:
node --check cortex-ui/src/api.js
node --check cortex-ui/src/main.js
Python tests also inspect selected UI security and contract behavior.
When changing server response rendering:
- escape ordinary fields with the local HTML escape helper
- send Markdown only through the sanitized renderer
- do not interpolate task, project, worker, candidate, or provider text into raw HTML
- update source-contract tests
- run both Node syntax checks
Known gaps
- no content security policy from the static server
- external browser dependencies instead of vendored copies
- fleet bearer stored in local storage
- no per-user authorization
- no client-scope administration
- no failure-gate override control
- no configurable API scheme, hostname, or reverse-proxy base path
- no offline service-worker behavior
- the browser end-to-end suite in
tests/browseris not run by CI and needs Playwright installed locally