feat: split help into tabbed UI Guide / Tools / Persona pages

- cortex/static/TOOLS.md — tool reference extracted from HELP.md; uses ##
  headers so each category is collapsible. All 30 tools with descriptions.
- cortex/static/HELP.md — UI guide only; tools section replaced with a
  one-line pointer to the Tools tab.
- help.html — three tabs (UI Guide / Tools / Persona); tab choice persists
  in localStorage. Tools tab defaults all sections open. Persona tab shows
  home/{user}/persona/{name}/HELP.md with an empty-state message if unset.
- context_loader.py — loads cortex/static/TOOLS.md into context at tier 2+
  (replaces the previously empty persona HELP.md load). Persona HELP.md
  still loaded if non-empty, as persona-specific additions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Scott Idem
2026-04-30 22:25:47 -04:00
parent 552fd56abb
commit 5ad2e50d69
4 changed files with 257 additions and 213 deletions

View File

@@ -59,104 +59,7 @@ The orchestrator runs a multi-step tool loop:
The ⚡ toggle is **independent of the Role selector** — you can use any role (chat, coder, research, etc.) with or without tools. The orchestrator model is configured in **Account → Model Registry → Role Assignments → Orchestrator**. By default this is Gemini API.
**Available tools:**
¹ Admin only — requires the `admin` role. Invisible to regular users.
² Confirmation required — the orchestrator pauses and shows Confirm / Deny buttons before executing.
**Web**
| Tool | What it does |
|---|---|
| `web_search` | DuckDuckGo search — returns titles, URLs, and snippets for the top results |
| `http_fetch` | Fetch a specific URL and return the response body (8 192 char cap) |
**Files** ¹
| Tool | What it does |
|---|---|
| `file_read` ¹ | Read any file under the persona home directory |
| `file_list` ¹ | List files and directories with sizes (200 entry cap) |
| `file_write` ¹ ² | Write or append to a file under the persona home directory |
**Shell** ¹
| Tool | What it does |
|---|---|
| `shell_exec` ¹ ² | Run any shell command on the Cortex host; timeout 1120 s |
| `claude_allow_dir` ¹ | Add a directory to Claude Code's auto-allowed paths |
**System** ¹
| Tool | What it does |
|---|---|
| `cortex_restart` ¹ ² | Restart the Cortex service (5 s delay); connection drops — refresh the page |
| `cortex_logs` ¹ | Recent lines from the systemd journal (default 50, max 200) |
| `cortex_status` ¹ | Current git branch, commit, ahead/behind remote, and service state |
| `cortex_update` ¹ ² | `git pull` + syntax check all `.py` files; reports what changed. Does **not** restart automatically — call `cortex_restart` after reviewing |
**Tasks**
| Tool | What it does |
|---|---|
| `task_list` | List personal tasks; pass `include_done=true` to include completed |
| `task_create` | Create a task with title, optional notes and due date |
| `task_update` | Update any fields on an existing task |
| `task_complete` | Mark a task as complete |
**Cron**
| Tool | What it does |
|---|---|
| `cron_list` | List all scheduled jobs for this persona |
| `cron_add` | Add a scheduled job — accepts cron syntax or plain-English interval |
| `cron_remove` ² | Remove a scheduled job by ID |
| `cron_toggle` | Enable or disable a job without removing it |
**Reminders**
| Tool | What it does |
|---|---|
| `reminders_add` | Add a reminder with optional label; surfaced in context at Tier 2+ |
| `reminders_list` | List all pending reminders, numbered for easy removal |
| `reminders_remove` | Remove a single reminder by number (call `reminders_list` first) |
| `reminders_clear` ² | Clear all reminders at once |
**Scratchpad**
| Tool | What it does |
|---|---|
| `scratch_read` | Read the current scratchpad |
| `scratch_write` | Overwrite the scratchpad with new content |
| `scratch_append` | Append a timestamped section to the scratchpad |
| `scratch_clear` | Erase the scratchpad |
**Notifications** ¹
| Tool | What it does |
|---|---|
| `email_send` ¹ | Send an email via SMTP; recipient must match your `email_allowlist.json` |
| `nc_talk_send` ¹ | Send a message to a Nextcloud Talk conversation |
**Aether Journals**
| Tool | What it does |
|---|---|
| `ae_journal_list` | List all journals for the configured AE account (returns names + IDs) |
| `ae_journal_search` | Search entries by keyword, tag, date range, type, status, or priority |
| `ae_journal_entries_list` | Browse all entries in a specific journal, newest first; paginated |
| `ae_journal_entry_read` | Read the full content of a single entry by ID |
| `ae_journal_entry_create` | Create a new entry with title, content, tags, and summary |
| `ae_journal_entry_update` | Patch any fields on an existing entry (title, content, tags, summary, enable) |
| `ae_journal_entry_disable` | Soft-delete an entry (`enable=false`) without permanently removing it |
| `ae_journal_entry_append` | Append a timestamped section to the bottom of an entry's content |
| `ae_journal_entry_prepend` | Prepend a timestamped section to the top of an entry's content |
**Aether Tasks** ¹
| Tool | What it does |
|---|---|
| `ae_task_list` ¹ | List tasks from the agents_sync Kanban board (admin only) |
The full tool reference is in the **Tools** tab. 30 tools across web, files, shell, system, tasks, cron, reminders, scratchpad, notifications, and Aether Journals.
Tools mode is best for tasks requiring research, multi-step reasoning, or side effects (e.g. "search for X", "add a task", "what's on my list?", "append this to my journal"). Regular chat is faster for conversational turns.

103
cortex/static/TOOLS.md Normal file
View File

@@ -0,0 +1,103 @@
# Tool Reference
> This reference covers all 30 orchestrator tools available when the ⚡ toggle is on.
> Tools are invoked automatically by the orchestrator — you don't call them directly.
¹ **Admin only** — requires the `admin` role. Invisible to regular users.
² **Confirmation required** — the orchestrator pauses and shows **Confirm / Deny** buttons before executing.
---
## Web
| Tool | What it does |
|---|---|
| `web_search` | DuckDuckGo search — returns titles, URLs, and snippets for the top results |
| `http_fetch` | Fetch a specific URL and return the response body (8 192 char cap) |
## Files ¹
| Tool | What it does |
|---|---|
| `file_read` ¹ | Read any file under the persona home directory |
| `file_list` ¹ | List files and directories with sizes (200 entry cap) |
| `file_write` ¹ ² | Write or append to a file under the persona home directory |
## Shell ¹
| Tool | What it does |
|---|---|
| `shell_exec` ¹ ² | Run any shell command on the Cortex host; timeout 1120 s |
| `claude_allow_dir` ¹ | Add a directory to Claude Code's auto-allowed paths |
## System ¹
| Tool | What it does |
|---|---|
| `cortex_restart` ¹ ² | Restart the Cortex service (5 s delay); connection drops — refresh the page |
| `cortex_logs` ¹ | Recent lines from the systemd journal (default 50, max 200) |
| `cortex_status` ¹ | Current git branch, commit, ahead/behind remote, and service state |
| `cortex_update` ¹ ² | `git pull` + syntax check all `.py` files; reports what changed. Does **not** restart automatically — call `cortex_restart` after reviewing |
## Tasks
| Tool | What it does |
|---|---|
| `task_list` | List personal tasks; pass `include_done=true` to include completed |
| `task_create` | Create a task with title, optional notes and due date |
| `task_update` | Update any fields on an existing task |
| `task_complete` | Mark a task as complete |
## Cron
| Tool | What it does |
|---|---|
| `cron_list` | List all scheduled jobs for this persona |
| `cron_add` | Add a scheduled job — accepts cron syntax or plain-English interval |
| `cron_remove` ² | Remove a scheduled job by ID |
| `cron_toggle` | Enable or disable a job without removing it |
## Reminders
| Tool | What it does |
|---|---|
| `reminders_add` | Add a reminder with optional label; surfaced in context at Tier 2+ |
| `reminders_list` | List all pending reminders, numbered for easy removal |
| `reminders_remove` | Remove a single reminder by number (call `reminders_list` first) |
| `reminders_clear` ² | Clear all reminders at once |
## Scratchpad
| Tool | What it does |
|---|---|
| `scratch_read` | Read the current scratchpad |
| `scratch_write` | Overwrite the scratchpad with new content |
| `scratch_append` | Append a timestamped section to the scratchpad |
| `scratch_clear` | Erase the scratchpad |
## Notifications ¹
| Tool | What it does |
|---|---|
| `email_send` ¹ | Send an email via SMTP; recipient must match your `email_allowlist.json` |
| `nc_talk_send` ¹ | Send a message to a Nextcloud Talk conversation |
## Aether Journals
| Tool | What it does |
|---|---|
| `ae_journal_list` | List all journals for the configured AE account (returns names + IDs) |
| `ae_journal_search` | Search entries by keyword, tag, date range, type, status, or priority |
| `ae_journal_entries_list` | Browse all entries in a specific journal, newest first; paginated |
| `ae_journal_entry_read` | Read the full content of a single entry by ID |
| `ae_journal_entry_create` | Create a new entry with title, content, tags, and summary |
| `ae_journal_entry_update` | Patch any fields on an existing entry (title, content, tags, summary, enable) |
| `ae_journal_entry_disable` | Soft-delete an entry (`enable=false`) without permanently removing it |
| `ae_journal_entry_append` | Append a timestamped section to the bottom of an entry's content |
| `ae_journal_entry_prepend` | Prepend a timestamped section to the top of an entry's content |
## Aether Tasks ¹
| Tool | What it does |
|---|---|
| `ae_task_list` ¹ | List tasks from the agents_sync Kanban board |

View File

@@ -16,6 +16,7 @@
--pg-text: #e2e8f0; --pg-muted: #94a3b8;
--pg-dim: #64748b; --pg-dimmer: #475569;
--pg-bright: #cbd5e1; --pg-nav-hover: rgba(255,255,255,0.05);
--pg-accent: #a78bfa;
}
[data-theme="light"] {
--pg-bg: #f4f2fa; --pg-surface: #ffffff;
@@ -23,6 +24,7 @@
--pg-text: #1a1228; --pg-muted: #5a5478;
--pg-dim: #7a7290; --pg-dimmer: #9e98b0;
--pg-bright: #1a1228; --pg-nav-hover: rgba(0,0,0,0.05);
--pg-accent: #7c3aed;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
@@ -38,110 +40,97 @@
padding: 2rem 1.5rem;
}
.page {
max-width: 720px;
margin: 0 auto;
}
.page { max-width: 720px; margin: 0 auto; }
/* ── Page nav ── */
.page-nav {
display: flex;
align-items: center;
gap: 0.25rem;
margin-bottom: 1.75rem;
flex-wrap: wrap;
display: flex; align-items: center; gap: 0.25rem;
margin-bottom: 1.75rem; flex-wrap: wrap;
}
.nav-link {
display: inline-flex;
align-items: center;
padding: 0.3rem 0.6rem;
border-radius: 6px;
font-size: 0.8rem;
font-weight: 500;
color: var(--pg-dim);
text-decoration: none;
transition: color 0.15s, background 0.15s;
white-space: nowrap;
display: inline-flex; align-items: center;
padding: 0.3rem 0.6rem; border-radius: 6px;
font-size: 0.8rem; font-weight: 500; color: var(--pg-dim);
text-decoration: none; transition: color 0.15s, background 0.15s; white-space: nowrap;
}
.nav-link:hover { color: var(--pg-bright); background: var(--pg-nav-hover); }
.nav-link.active { color: #a78bfa; }
.nav-link.active { color: var(--pg-accent); }
.nav-spacer { flex: 1; min-width: 0.5rem; }
.nav-link.nav-logout { color: var(--pg-dimmer); }
.nav-link.nav-logout:hover { color: var(--pg-muted); background: none; }
header {
margin-bottom: 2rem;
padding-bottom: 1rem;
border-bottom: 1px solid var(--pg-border);
}
header h1 { font-size: 1.5rem; font-weight: 700; color: #a78bfa; }
/* ── Header ── */
header { margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--pg-border); }
header h1 { font-size: 1.5rem; font-weight: 700; color: var(--pg-accent); }
header p { font-size: 0.85rem; color: var(--pg-muted); margin-top: 0.25rem; }
#help-body { line-height: 1.7; }
/* ── Tabs ── */
.tab-bar {
display: flex; gap: 0.25rem;
margin-bottom: 1.25rem;
border-bottom: 1px solid var(--pg-border);
padding-bottom: 0;
}
.tab-btn {
padding: 0.45rem 1rem;
font-size: 0.85rem; font-weight: 500;
color: var(--pg-dim);
background: none; border: none; border-bottom: 2px solid transparent;
cursor: pointer; transition: color 0.15s, border-color 0.15s;
margin-bottom: -1px;
}
.tab-btn:hover { color: var(--pg-bright); }
.tab-btn.active { color: var(--pg-accent); border-bottom-color: var(--pg-accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
/* ── Content ── */
.help-body { line-height: 1.7; }
/* Collapsible sections */
details {
margin-bottom: 0.75rem;
background: var(--pg-surface);
border: 1px solid var(--pg-border);
border-radius: 8px;
overflow: hidden;
border-radius: 8px; overflow: hidden;
}
summary {
padding: 0.85rem 1rem;
font-weight: 600;
font-size: 0.95rem;
color: var(--pg-bright);
cursor: pointer;
list-style: none;
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.85rem 1rem; font-weight: 600; font-size: 0.95rem;
color: var(--pg-bright); cursor: pointer; list-style: none;
display: flex; align-items: center; gap: 0.5rem;
}
summary::before {
content: '▶';
font-size: 0.65rem;
color: var(--pg-muted);
content: '▶'; font-size: 0.65rem; color: var(--pg-muted);
transition: transform 0.15s;
}
details[open] summary::before { transform: rotate(90deg); }
summary::-webkit-details-marker { display: none; }
details > *:not(summary) { padding: 0 1rem 1rem; }
details > *:not(summary) {
padding: 0 1rem 1rem;
.help-body p { margin: 0.5rem 0; font-size: 0.9rem; color: var(--pg-bright); }
.help-body ul { margin: 0.5rem 0 0.5rem 1.25rem; }
.help-body li { font-size: 0.9rem; color: var(--pg-bright); margin-bottom: 0.25rem; }
.help-body strong { color: var(--pg-text); }
.help-body code {
background: var(--pg-bg); border: 1px solid var(--pg-border);
border-radius: 4px; padding: 0.1em 0.4em;
font-size: 0.85em; color: var(--pg-accent);
}
#help-body p { margin: 0.5rem 0; font-size: 0.9rem; color: var(--pg-bright); }
#help-body ul { margin: 0.5rem 0 0.5rem 1.25rem; }
#help-body li { font-size: 0.9rem; color: var(--pg-bright); margin-bottom: 0.25rem; }
#help-body strong { color: var(--pg-text); }
#help-body code {
background: var(--pg-bg);
border: 1px solid var(--pg-border);
border-radius: 4px;
padding: 0.1em 0.4em;
font-size: 0.85em;
color: #a78bfa;
.help-body a { color: var(--pg-accent); }
.help-body h1 { font-size: 1.1rem; font-weight: 700; color: var(--pg-text); margin: 0.75rem 0 0.5rem; }
.help-body h3 {
font-size: 0.8rem; font-weight: 600; color: var(--pg-muted);
text-transform: uppercase; letter-spacing: 0.05em; margin: 0.75rem 0 0.25rem;
}
#help-body a { color: #a78bfa; }
.help-body table { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin: 0.5rem 0 0.75rem; }
.help-body th, .help-body td { padding: 0.45rem 0.7rem; text-align: left; border-bottom: 1px solid var(--pg-border); }
.help-body th { color: var(--pg-muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.help-body td { color: var(--pg-bright); }
.help-body pre { background: var(--pg-bg); border: 1px solid var(--pg-border); border-radius: 6px; padding: 0.75rem 1rem; overflow-x: auto; margin: 0.5rem 0; }
.help-body pre code { background: none; border: none; padding: 0; font-size: 0.85em; color: var(--pg-muted); }
.help-body hr { border: none; border-top: 1px solid var(--pg-border); margin: 0.5rem 0; }
#help-body h3 {
font-size: 0.8rem;
font-weight: 600;
color: var(--pg-muted);
text-transform: uppercase;
letter-spacing: 0.05em;
margin: 0.75rem 0 0.25rem;
}
#loading { color: var(--pg-muted); font-size: 0.9rem; padding: 1rem 0; }
#help-body table { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin: 0.5rem 0 0.75rem; }
#help-body th, #help-body td { padding: 0.45rem 0.7rem; text-align: left; border-bottom: 1px solid var(--pg-border); }
#help-body th { color: var(--pg-muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
#help-body td { color: var(--pg-bright); }
#help-body pre { background: var(--pg-bg); border: 1px solid var(--pg-border); border-radius: 6px; padding: 0.75rem 1rem; overflow-x: auto; margin: 0.5rem 0; }
#help-body pre code { background: none; border: none; padding: 0; font-size: 0.85em; color: var(--pg-muted); }
#help-body hr { border: none; border-top: 1px solid var(--pg-border); margin: 0.5rem 0; }
.empty-state { color: var(--pg-dim); font-size: 0.9rem; padding: 2rem 0; text-align: center; }
</style>
</head>
<body>
@@ -159,7 +148,15 @@
<p id="persona-label"></p>
</header>
<div id="help-body"><p id="loading">Loading…</p></div>
<div class="tab-bar">
<button class="tab-btn active" data-tab="ui">UI Guide</button>
<button class="tab-btn" data-tab="tools">Tools</button>
<button class="tab-btn" data-tab="persona" id="tab-btn-persona">Persona</button>
</div>
<div id="tab-ui" class="tab-panel active"><div class="help-body"><p class="empty-state">Loading…</p></div></div>
<div id="tab-tools" class="tab-panel"> <div class="help-body"><p class="empty-state">Loading…</p></div></div>
<div id="tab-persona" class="tab-panel"> <div class="help-body"><p class="empty-state">Loading…</p></div></div>
</div>
<script>
@@ -168,21 +165,41 @@
const persona = cfg.persona || 'inara';
const params = `user=${encodeURIComponent(user)}&persona=${encodeURIComponent(persona)}`;
// Wire up nav links and persona label
document.getElementById('nav-chat').href = cfg.backHref || '/';
if (persona) {
document.getElementById('persona-label').textContent =
`${persona.charAt(0).toUpperCase() + persona.slice(1)} · ${user}`;
}
const OPEN_SECTIONS = new Set(['Header Controls', 'Chat', 'Sessions', 'Notes']);
// Rename Persona tab to the actual persona name
const personaTabBtn = document.getElementById('tab-btn-persona');
personaTabBtn.textContent = persona.charAt(0).toUpperCase() + persona.slice(1);
function makeCollapsible(container) {
const h2s = Array.from(container.querySelectorAll('h2'));
for (const h2 of h2s) {
// ── Tab switching ────────────────────────────────────────────────
const tabBtns = document.querySelectorAll('.tab-btn');
const tabPanels = document.querySelectorAll('.tab-panel');
const TAB_KEY = `cx_help_tab_${user}_${persona}`;
function activateTab(name) {
tabBtns.forEach(b => b.classList.toggle('active', b.dataset.tab === name));
tabPanels.forEach(p => p.classList.toggle('active', p.id === `tab-${name}`));
try { localStorage.setItem(TAB_KEY, name); } catch (_) {}
}
tabBtns.forEach(btn => btn.addEventListener('click', () => activateTab(btn.dataset.tab)));
// Restore last active tab
try {
const saved = localStorage.getItem(TAB_KEY);
if (saved) activateTab(saved);
} catch (_) {}
// ── Collapsible h2 sections ──────────────────────────────────────
function makeCollapsible(container, openAll = false, openSet = null) {
container.querySelectorAll('h2').forEach(h2 => {
const title = h2.textContent.trim();
const details = document.createElement('details');
if (OPEN_SECTIONS.has(title)) details.open = true;
if (openAll || (openSet && openSet.has(title))) details.open = true;
const summary = document.createElement('summary');
summary.textContent = title;
@@ -190,46 +207,57 @@
const siblings = [];
let node = h2.nextSibling;
while (node && node.nodeName !== 'H2') {
siblings.push(node);
node = node.nextSibling;
}
for (const sib of siblings) details.appendChild(sib);
while (node && node.nodeName !== 'H2') { siblings.push(node); node = node.nextSibling; }
siblings.forEach(s => details.appendChild(s));
h2.parentNode.replaceChild(details, h2);
}
});
}
async function loadHelp() {
// ── Render markdown into a panel ────────────────────────────────
function render(panelId, markdown, openAll, openSet) {
const panel = document.querySelector(`#${panelId} .help-body`);
panel.innerHTML = marked.parse(markdown);
panel.querySelectorAll('a').forEach(a => { a.target = '_blank'; a.rel = 'noopener noreferrer'; });
makeCollapsible(panel, openAll, openSet);
}
// ── Load all three tabs in parallel ─────────────────────────────
const UI_OPEN = new Set(['Header Controls', 'Chat', 'Sessions', 'Notes']);
async function loadAll() {
// UI Guide
fetch('/static/HELP.md')
.then(r => r.ok ? r.text() : Promise.reject(r.status))
.then(md => render('tab-ui', md, false, UI_OPEN))
.catch(e => { document.querySelector('#tab-ui .help-body').innerHTML = `<p class="empty-state">Failed to load: ${e}</p>`; });
// Tools
fetch('/static/TOOLS.md')
.then(r => r.ok ? r.text() : Promise.reject(r.status))
.then(md => render('tab-tools', md, true, null))
.catch(e => { document.querySelector('#tab-tools .help-body').innerHTML = `<p class="empty-state">Failed to load: ${e}</p>`; });
// Persona-specific HELP.md
const personaPanel = document.querySelector('#tab-persona .help-body');
try {
// Always load the shared base from static
const baseRes = await fetch('/static/HELP.md');
if (!baseRes.ok) throw new Error(`HTTP ${baseRes.status}`);
let markdown = await baseRes.text();
// Try to load persona-specific additions and append them
try {
const personaRes = await fetch(`/files/HELP.md?${params}`);
if (personaRes.ok) {
const personaData = await personaRes.json();
const extra = (personaData.content || '').trim();
if (extra) {
markdown += '\n\n---\n\n## ' + persona.charAt(0).toUpperCase() + persona.slice(1) + ' Notes\n\n' + extra;
}
const res = await fetch(`/files/HELP.md?${params}`);
if (res.ok) {
const data = await res.json();
const content = (data.content || '').trim();
if (content) {
render('tab-persona', content, true, null);
} else {
personaPanel.innerHTML = `<p class="empty-state">No ${persona}-specific notes yet. Edit <code>HELP.md</code> in the Files panel to add them.</p>`;
}
} catch (_) { /* persona-specific file is optional */ }
const body = document.getElementById('help-body');
body.innerHTML = marked.parse(markdown);
body.querySelectorAll('a').forEach(a => {
a.target = '_blank'; a.rel = 'noopener noreferrer';
});
makeCollapsible(body);
} catch (err) {
document.getElementById('help-body').textContent = `Failed to load help: ${err.message}`;
} else {
personaPanel.innerHTML = `<p class="empty-state">No ${persona}-specific notes yet.</p>`;
}
} catch (_) {
personaPanel.innerHTML = `<p class="empty-state">No ${persona}-specific notes yet.</p>`;
}
}
loadHelp();
loadAll();
</script>
</body>
</html>