Summary
Add a Settings panel to the SPARK web dashboard (GET /) covering all runtime configuration: session state, voice tuning, mind backend, and data backup/export. Currently none of this is accessible from the UI — you have to SSH in and edit files.
Scope
UI — new "Settings" tab in sidebar or gear icon → modal/panel
Five collapsible sections:
1. Session & Persona
Fields (all editable, PATCH /api/v1/session on save):
| Field |
Type |
Notes |
persona |
select: spark / gremlin / vixen / — |
Live switch |
confirm_motion_allowed |
toggle |
Safety gate |
wheels_on_blocks |
toggle |
Dev safety |
spark_quiet_mode |
toggle |
Regulation state |
obi_routine |
text (read-only) |
Current routine name |
obi_step |
number (read-only) |
Current step index |
obi_mood |
text (read-only) |
Last recorded mood |
obi_streak |
number (read-only) |
Current streak count |
2. Voice
Fields (saved to a new PATCH /api/v1/voice endpoint that writes env overrides to session):
| Field |
Type |
Range |
variant |
select: en+m3 / en+f4 / en+croak / … |
espeak voice variants |
pitch |
slider |
0–99 |
rate |
slider |
80–200 |
- Preview button: calls
tool_voice with "Hello, I'm SPARK" using current slider values
- Changes written to session (
voice_variant, voice_pitch, voice_rate) and picked up by execute_tool()'s persona env injection
3. Mind & Model
Fields (saved to .env via new PATCH /api/v1/config endpoint):
| Field |
Type |
Default |
PX_MIND_BACKEND |
select: claude / ollama |
claude |
PX_MIND_CLAUDE_MODEL |
select: claude-haiku-4-5-20251001 / claude-sonnet-4-6 |
claude-haiku-4-5-20251001 |
PX_OLLAMA_HOST |
text |
http://M1.local:11434 |
PX_MIND_MODEL |
text |
qwen3.5:0.8b |
PX_OLLAMA_HOST (tool-chat) |
text |
same |
| Awareness interval |
number (seconds) |
30 |
| Reflection interval (idle) |
number (seconds) |
120 |
4. Backup & Export
Buttons only — no editing:
| Button |
Action |
Notes |
| Download session.json |
GET /api/v1/backup/session |
Direct file download |
| Download notes (SPARK) |
GET /api/v1/backup/notes |
notes-spark.jsonl |
| Download thoughts (SPARK) |
GET /api/v1/backup/thoughts |
thoughts-spark.jsonl |
| Download full backup |
GET /api/v1/backup/all |
ZIP: all state + .env (masked) |
| Export config JSON |
GET /api/v1/config |
All non-secret settings as JSON |
| Restore from backup |
POST /api/v1/backup/restore |
Upload ZIP — restores state files |
5. Danger Zone
| Action |
Confirmation required |
| Clear SPARK thoughts |
Wipes thoughts-spark.jsonl |
| Clear SPARK notes |
Wipes notes-spark.jsonl |
| Reset session to defaults |
Restores session.template.json |
| Restart API server |
Kills + relaunches px-api-server |
All danger actions require a confirmation dialog ("Type CONFIRM to proceed").
New API endpoints required
| Method |
Path |
Auth |
Description |
| GET |
/api/v1/config |
Yes |
All non-secret runtime config as JSON |
| PATCH |
/api/v1/config |
Yes |
Update .env-based config (model, host, intervals) |
| PATCH |
/api/v1/voice |
Yes |
Update voice settings (variant/pitch/rate) in session |
| GET |
/api/v1/backup/session |
Yes |
Download session.json |
| GET |
/api/v1/backup/notes |
Yes |
Download notes-{persona}.jsonl |
| GET |
/api/v1/backup/thoughts |
Yes |
Download thoughts-{persona}.jsonl |
| GET |
/api/v1/backup/all |
Yes |
Download ZIP of all state files |
| POST |
/api/v1/backup/restore |
Yes |
Upload ZIP, restore state files |
.env editing safety
.env writes go through a dedicated write_env_var(key, value) helper that:
- Reads existing
.env line by line
- Updates matching key in-place or appends
- Writes atomically (temp file + rename)
- Never exposes
PX_API_TOKEN or ANTHROPIC_API_KEY values in GET /api/v1/config responses (mask as "***")
Implementation order
GET /api/v1/config + GET /api/v1/backup/* endpoints (read-only, safe)
- Settings panel UI (tabbed sections, read-only first)
- Session edit fields +
PATCH /api/v1/voice
PATCH /api/v1/config + .env writer
- Backup ZIP download + restore upload
- Danger zone actions
Non-goals
- No live log streaming (separate issue)
- No file browser
- No SSH terminal in browser
- No user management / multi-user auth
Summary
Add a Settings panel to the SPARK web dashboard (
GET /) covering all runtime configuration: session state, voice tuning, mind backend, and data backup/export. Currently none of this is accessible from the UI — you have to SSH in and edit files.Scope
UI — new "Settings" tab in sidebar or gear icon → modal/panel
Five collapsible sections:
1. Session & Persona
Fields (all editable, PATCH /api/v1/session on save):
personaconfirm_motion_allowedwheels_on_blocksspark_quiet_modeobi_routineobi_stepobi_moodobi_streak2. Voice
Fields (saved to a new
PATCH /api/v1/voiceendpoint that writes env overrides to session):variantpitchratetool_voicewith "Hello, I'm SPARK" using current slider valuesvoice_variant,voice_pitch,voice_rate) and picked up byexecute_tool()'s persona env injection3. Mind & Model
Fields (saved to
.envvia newPATCH /api/v1/configendpoint):PX_MIND_BACKENDclaudePX_MIND_CLAUDE_MODELclaude-haiku-4-5-20251001PX_OLLAMA_HOSThttp://M1.local:11434PX_MIND_MODELqwen3.5:0.8bPX_OLLAMA_HOST(tool-chat)4. Backup & Export
Buttons only — no editing:
GET /api/v1/backup/sessionGET /api/v1/backup/notesGET /api/v1/backup/thoughtsGET /api/v1/backup/allGET /api/v1/configPOST /api/v1/backup/restore5. Danger Zone
All danger actions require a confirmation dialog (
"Type CONFIRM to proceed").New API endpoints required
/api/v1/config/api/v1/config/api/v1/voice/api/v1/backup/session/api/v1/backup/notes/api/v1/backup/thoughts/api/v1/backup/all/api/v1/backup/restore.env editing safety
.envwrites go through a dedicatedwrite_env_var(key, value)helper that:.envline by linePX_API_TOKENorANTHROPIC_API_KEYvalues in GET /api/v1/config responses (mask as"***")Implementation order
GET /api/v1/config+GET /api/v1/backup/*endpoints (read-only, safe)PATCH /api/v1/voicePATCH /api/v1/config+.envwriterNon-goals