Commit graph

54 commits

Author SHA1 Message Date
bal-spec
cb460e734f docs: add Connection Profile docs, new screenshots, and minor fixes
- Document Connection Profiles as 4th extraction source in providers.md
  with creation steps, settings table, and usage instructions
- Add screenshots: Settings Modal tabs (connection, profile, extraction,
  storage), Connection Profile toolbar bar and creation dialog
- Refresh wizard-step1.png and panel-full.png screenshots
- Document "Protect recent messages" feature in managing-memories.md
- Add Connection Profile mentions to getting-started.md, README.md,
  and architecture.md
- Bump manifest.json version to 2.1.9
- Fix tooltip "Injection Sidebar" → "Injection Viewer" in settings.html
- Add issue #10 per-chat memory storage backlog analysis

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-18 21:55:19 -07:00
bal-spec
dc0eab2638 v2.1.6 — UX redesign, injection viewer, unified editor, token breakdown
Complete rewrite of the UI and significant feature additions since v1.6.1.

UX Redesign (v2.0):
- Single-view dashboard replaces 4-tab sidebar
- Settings, Prompts, Troubleshooter, Memory Manager moved to center-screen modals
- Activity log in slide-out drawer
- Setup Wizard for first-run configuration
- Prompt version tracking with update notifications
- Health indicator in stats bar

Injection Viewer (v1.6–v2.1.6):
- Per-message injection data: see exactly what memories, lorebook entries,
  and extension prompts were injected for any generation
- Context/Prompt Breakdown with per-category token counts (System, Char card,
  Lorebook, Data Bank, Examples, Chat history) via ST Prompt Itemization
- Stacked bar visualization, token hints in headers, Tips popup
- Context overflow and heavy injection warnings

Memory Management:
- Unified block editor across all 5 editing surfaces (Memory Manager,
  Consolidation, Conversion, Reformat, Data Bank browser)
- Find & Replace with highlighting across all editors
- Undo support for all edit operations
- Group chat character picker in Memory Manager

Other features:
- Tablet & phone display modes with touch-friendly controls
- Topic-tagged memory format for better vector retrieval
- Self-closing memory tag handling (GLM-4.7 compatibility)
- Protect recent messages from extraction feedback loop
- 9-point health check system with retrieve chunks and score threshold
- Shared editor factory (editor.js), pure utility library (lib.js)
- Vitest test suite: unit, snapshot, and live LLM tests
- Full documentation suite in docs/

See CHANGELOG.md for detailed per-version notes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 15:20:14 -08:00
bal-spec
1078f5aefc fix: add helper text showing Base URL format and default ports
Show expected URL format (http://hostname:port/v1) and default ports
for each backend below the Base URL field when using the Local Server
preset.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 21:06:34 -08:00
bal-spec
4b81262902 fix: move Connect button after Base URL field in provider UI
Users need to set the URL before connecting. Reorder so the flow is:
API Key → Base URL → Connect → Model picker → Test Model.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 20:56:06 -08:00
bal-spec
ebe8ccc462 fix: show Connect button and clear stale model for keyless providers
The Connect button was inside the API key row, so it was hidden when
requiresApiKey was false (e.g., Local Server preset). Move it to its
own row controlled by modelsEndpoint. Also clear stale model display
on provider switch instead of auto-fetching from potentially offline
local servers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 20:51:06 -08:00
bal-spec
ee4598124b feat(injection-viewer): add injection health score with traffic light indicator
Adds a health scoring system that checks Vector Storage configuration
and surfaces issues at a glance:

- Status bar: colored dot (green/yellow/red) with hover tooltip
- Diagnostics panel: detailed breakdown of each health check
- Per-message: duplicate/missing memory warnings in injection drawer
- Click-to-navigate: status bar dot scrolls to diagnostics

Health checks: vector files enabled, memory file exists, file vectorized,
chunk overlap adequacy, chunk size vs block size, memories injected,
duplicate detection.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 22:56:23 -08:00
bal-spec
5cb444e55e feat: replace inline convert preview with interactive popup dialog
Convert tool now uses the same callGenericPopup pattern as consolidation:
- Side-by-side panes (original file vs editable memory cards)
- Full card editing (add/delete/edit blocks and bullets)
- Re-run with LLM toggle, version stack, and undo
- Output destination controls inside the dialog
- inApiCall guard prevents concurrent dialogs
- dialogClosed flag cancels stale re-run callbacks

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 12:37:32 -08:00
bal-spec
e9d007b957 feat: add chunk boundary format settings and heuristic file parser
Format settings: chunk boundary dropdown (block/bullet/custom),
custom separator input, metadata-in-chunks toggle. Settings persist
and conditionally show/hide dependent controls.

Heuristic parser: detectFileFormat() identifies 6 format types,
convertHeuristic() handles each with appropriate parsing strategy.
Includes defaultConversionPrompt for LLM fallback path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 11:52:16 -08:00
bal-spec
89ac603e40 refactor: restructure tabs into Main|Tools|Settings|Log with pill sub-nav
Replace 5 top-level tabs with 4. Consolidate and Batch move under a
Tools tab with pill-button sub-navigation. Add Convert tool HTML shell
with source dropdown, LLM prompt disclosure, and preview area.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 11:48:00 -08:00
bal-spec
b36ee17ec0 feat: searchable model picker, group avatars in stats bar, prompt titles
Three UX improvements:
- Model dropdown replaced with searchable text input (filter by typing,
  keyboard navigation, optgroup support for NanoGPT)
- Group chats show character avatar thumbnails in the stats bar with
  tooltip listing per-character memory filenames
- Extraction prompt labels now show "(1:1 chats)" or "(group chats)"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 21:52:11 -08:00
bal-spec
bcae251cd4 Merge branch 'consolidation-improvements' into beta
# Conflicts:
#	index.js
#	settings.html
2026-02-19 22:49:11 -08:00
bal-spec
d68975a9af feat: display resolved memory filename in settings
Show the auto-generated or resolved filename in the 1:1 section so
users can see what file will be used without needing to set an override.
Group section already showed this via the placeholder in member inputs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 22:43:02 -08:00
bal-spec
3bdaa2d448 feat: extend per-chat memory separation to group chats
Move the "Separate memories per chat" toggle to shared settings so it
applies to both 1:1 and group chats. Update getMemoryFileNameForCharacter
to generate per-chat filenames (e.g. Name-chat123-memories.md) when
enabled, with perChat-aware auto-detection of existing files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 22:40:01 -08:00
bal-spec
36b40a578c feat: context-aware settings — show only relevant chat type section
Hide 1:1 Chat settings when in a group chat, hide Group Chat settings
when in a 1:1 chat. Reduces clutter and only shows what's relevant.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 22:33:02 -08:00
bal-spec
80ac7350f0 fix: split button row into two rows for narrow viewports
Extract Now + View/Edit on first row, Consolidate + Undo on second row.
Prevents overflow on iPad landscape.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 22:26:04 -08:00
bal-spec
10bfe18361 feat: add per-character filename config for group chats
Restructure settings into separate 1:1 Chat and Group Chat sections.
Add dynamic group members list showing each character's resolved memory
filename with editable overrides.

Filename detection cascade: manual override → auto-detect existing
*-memories.md in character's Data Bank → auto-generated {Name}-memories.md.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 22:22:25 -08:00
bal-spec
ac18cf5dc4 feat: add group chat memory extraction
Extract per-character memories from group chats. Each NPC character
gets their own extraction call with their card and existing memories,
and results are written to their own Data Bank file.

- Add isGroupChat(), getGroupMembers() detection helpers
- Add per-character Data Bank read/write (bypasses this_chid)
- Add extractGroupMemories() with chunk × character loop
- Add group-specific extraction prompt with {{participants}} variable
- Branch extractMemories() to group path for active group chats
- Add group extraction mode setting and prompt UI
- Handle stale metadata detection for group chats in onChatChanged

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 02:11:09 -08:00
bal-spec
2cbb322e20 feat: add optional merge toggle and date/time extraction nudge
- Add "Merge extraction chunks" checkbox (default: off) so long
  chats produce multiple smaller blocks instead of one massive one
- Add "dates and times" to extraction prompt's WHAT TO EXTRACT list
  as a gentle nudge for temporal context

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 21:06:11 -08:00
bal-spec
bc5c52d228 feat: add Memory Extraction heading, move Select All next to Character Attachments
- Main tab gets "Memory Extraction" header with "Automatic" checkbox
- "Select all" moved inline with "Character Attachments" header
- New charMemory_sectionHeader CSS for label + control on same line

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 22:22:27 -08:00
bal-spec
f493f5b1e8 feat: move auto-extract checkbox to button row, rename batch tab, add attachments header
- Auto extraction checkbox moved next to Extract Now / View Edit
- Batch Extract tab renamed to Batch Extraction
- Added "Character Attachments" header with tooltip above chat list

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 22:19:37 -08:00
bal-spec
ccb5d1230b feat: move diagnostics and activity log to always-visible panel sections
- Activity Log labeled and always visible below tab content
- Diagnostics moved from Main tab to permanent pane at bottom
- Main tab now only has Extract Now and View/Edit buttons
- Click activity log to expand, hover also works

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 22:16:07 -08:00
bal-spec
880cd822ce feat: add persistent mini activity log at panel bottom
Shows last 3 log entries always visible below tabs, expandable
on click for more history. Uses max-height transition for smooth
expand/collapse.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 21:46:46 -08:00
bal-spec
e00631d074 feat: add expandable prompt viewer with per-preset editing
Replace hidden textarea + Custom option with <details> disclosure
showing the editable prompt for each strategy. Restore Default button
appears when a preset has been customized.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 21:41:24 -08:00
bal-spec
e3163ac7ac refactor: restructure panel to top-level tab layout
Replace nested drawer-based layout with top-level tabs (Main, Consolidate,
Batch Extract, Settings, Log). Move consolidation controls from Settings to
dedicated Consolidate tab. Move diagnostics from sub-tab into Main tab.
Remove Tools & Diagnostics drawer wrapper.

All element IDs preserved for JS compatibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 22:44:09 -08:00
bal-spec
ffec88db92 feat: add consolidation strategy UI with presets and custom prompt
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 21:59:59 -08:00
bal-spec
698c1e5924 feat: improve Test Model to verify model responds correctly
Rename Test to Test Model. Send a specific echo prompt and check
whether the model follows the instruction. Show model name, response
time, and actual reply in the inline status. Yellow warning if the
model responds but doesn't follow the instruction.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 15:39:40 -08:00
bal-spec
ee6ddc400a feat: add Connect button for model fetching, auto-hide API key after 10s
Replace auto-fetch-on-keystroke with explicit Connect button next to the
API key. Connect fetches the model list with inline status feedback.
Test button moved below model dropdown for logical flow: enter key →
Connect → pick model → Test.

API key reveal now auto-hides after 10 seconds as a security best practice.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 15:22:59 -08:00
bal-spec
3ab031bd51 fix: increase response length slider max to 4000 for reasoning models
Models like GLM-4.7 on NVIDIA use reasoning tokens that consume the
response budget before producing content. The previous max of 2000
was insufficient — bumped to 4000 to give thinking models headroom.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 14:02:31 -08:00
bal-spec
9cb02028a5 feat: inline test feedback below API key, fix stuck Testing button
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 10:26:04 -08:00
bal-spec
f2d0ae17fc feat: add API key reveal/hide toggle button
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 10:26:04 -08:00
bal-spec
8c41d3a37c ux: default to Dedicated API, reorder options, remove quick-start shortcut
- Default source changed from Main LLM to Dedicated API for better
  out-of-box extraction quality
- Dropdown reordered: Dedicated API first, WebLLM second, Main LLM last
- Removed "If you just want to get started quickly" section from
  getting started guide — steering all users toward the recommended path
- Updated all docs to reflect new ordering and default

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 18:25:08 -08:00
bal-spec
bdadbdd0ec ux: rename "API Provider" to "Dedicated API" and "LLM Provider" to "LLM Used for Extraction"
Clearer labels that tell users what the setting actually does.
Internal values (provider, main_llm, webllm) are unchanged.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 18:23:17 -08:00
bal-spec
ef624d3551 docs: add getting started guide and update extraction defaults
- Add GETTING-STARTED.md with step-by-step setup instructions covering
  installation, provider setup, Vector Storage config, and settings tuning
- Raise auto-extraction interval default from 10 to 20 messages for
  better extraction quality (more context per LLM call)
- Raise interval slider max from 50 to 100
- Update README with detailed slider interaction docs, Pin as Memory
  explanation, and link to getting started guide

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 18:03:19 -08:00
bal-spec
0db09a4d9b feat: inject character card into extraction prompt
Add {{charCard}} placeholder that injects the character's description
and personality into the extraction prompt. This lets the LLM see what
is baseline character knowledge and avoid extracting it as memories.

Update default prompt with CHARACTER CARD section and strengthened
instructions to skip card-redundant info. Add note recommending API
Provider over Main LLM due to prompt pollution.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 14:02:47 -08:00
bal-spec
57d4a99c91 feat: multi-provider support — replace NanoGPT with unified API Provider system
Add support for 11 LLM providers (OpenAI, Anthropic, OpenRouter, Groq,
DeepSeek, Mistral, xAI, NanoGPT, Ollama, Pollinations, Custom) with
per-provider settings, preset-based dispatch, and automatic migration
from the previous NanoGPT-only configuration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 13:24:06 -08:00
bal-spec
12016c3f15 feat: increase activity log capacity to 500 and add Save Log export button
Retaining only 50 entries was losing history during long batch runs.
Bump to 500 and add a download button so the log can be saved as a
timestamped text file.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 12:21:30 -08:00
bal-spec
c38a1c2f32 feat: v3 extraction prompt, auto-consolidation, slider UX improvements
- Replace extraction prompt with v3: 8-bullet hard cap, bad_example
  negative example, "months later" framing, shorter AVOID list
- Add auto-consolidation pass after multi-chunk extraction (threshold: 10)
- Convert sliders to neo-range-slider + neo-range-input pattern
- Update defaults: messages per call 20→50, response length 800→1000
- Add v2→v3 prompt migration and settings clamp
- Update README: GLM 4.7 recommended, updated tips/troubleshooting

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 10:40:25 -08:00
bal-spec
571e5e42c3 fix: Reset Extraction State now clears batch state for all character chats
Previously only reset the active chat's metadata, so batch extraction
still saw other chats as fully processed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 20:04:14 -08:00
bal-spec
b9f7d3f9f4 feat: add verbose logging toggle for LLM prompts and responses
Adds phase logging (Sending/Waiting/Response received with timing)
always visible in activity log. When "Verbose" checkbox is enabled,
also logs the full prompt and raw LLM response.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 19:34:33 -08:00
bal-spec
ec75f55304 refactor: reorganize settings UX with clearer labels and grouping
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 15:37:03 -08:00
bal-spec
5361169002 Improve extraction quality, fix per-message buttons, add tooltips and docs
Extraction prompt:
- Replace broad "sexual mechanics" AVOID with targeted "repetitive minutiae"
- Add NOTE: capture vivid memorable details, skip sequential play-by-play
- Add clear boundary markers (===== sections) between existing memories and
  chat content to prevent weaker models from contaminating extractions
- Add CRITICAL instruction: only extract from RECENT CHAT MESSAGES section

Per-message buttons:
- Add addButtonsToExistingMessages() to inject brain/bookmark buttons on
  already-rendered messages when a chat loads (called from onChatChanged)

UX polish:
- Add descriptive tooltips to all UI elements (stats bar, buttons, sliders,
  settings, tabs)
- Rename "Extract every N messages" to "Auto-extract every N new messages"
- Improve "no new messages" toast on manual Extract Now to suggest Reset
  Extraction State
- Update Extract Now tooltip to explain the reset workflow

Docs:
- Add "Choosing an LLM for Memory Extraction" section to README with
  recommended models (DeepSeek V3.1, Qwen3-235B, Mistral Large 3, Hermes 4),
  models to avoid, and troubleshooting guide
- Update README for cooldown, tabbed panel, stats bar, per-message buttons
- Update PLAN.md with completed items and new extraction quality ideas

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 10:58:36 -08:00
bal-spec
3d541afaf2 Improve extraction prompt, add cooldown, tabbed panel, richer stats bar
- Replace default extraction prompt with higher-quality version: AVOID list
  (sexual mechanics, temporary states, dialogue), FOCUS categories, past
  tense rule, consolidation/fact-checking rules, better examples
- Bump default responseLength from 500 to 800
- Add minCooldownMinutes setting (default 10, range 0-30) to prevent
  rapid-fire extractions; manual extractions bypass cooldown
- Combine Activity Log + Diagnostics into single tabbed drawer
- Expand stats bar from 2 to 4 items: file, memory count, extraction
  progress (msgs/interval), cooldown timer with auto-refresh
- Fix stats bar showing stale count after Clear All Memories

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 10:25:27 -08:00
bal-spec
f3ab5ccfb8 Add activity log and fix extraction not running on chat switch
- Add collapsible Activity Log panel that shows timestamped events:
  chat switches, extraction state, message collection, LLM responses
- Fix bug where lastExtractedIndex advanced even when LLM returned
  NO_NEW_MEMORIES, preventing subsequent manual extraction from
  processing messages on a switched-to chat
- Now only advance lastExtractedIndex when memories are actually saved;
  always reset messagesSinceExtraction to prevent re-trigger loops

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 22:29:55 -08:00
bal-spec
36b59a5e17 Add NanoGPT connection test, model filters, and fix chat-switch extraction bug
- Add Test button next to API key to verify connection with a minimal request
- Add model filter checkboxes (Subscription, Open Source, Roleplay, Reasoning)
  that narrow the dropdown with intersection logic
- Store additional model fields (isOpenSource, category, capabilities, costEstimate)
- Fix bug where switching chats didn't seed messagesSinceExtraction with
  unextracted message count, preventing automatic extraction from triggering

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 22:19:24 -08:00
bal-spec
bf22c2019a Add NanoGPT as direct API extraction source
Allows using NanoGPT's OpenAI-compatible API for memory extraction
and consolidation, independent of the main chat LLM. Fetches model
list with subscription status, supports custom system prompts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 22:05:15 -08:00
bal-spec
6b77a5d209 Add Reset Extraction State button
Allows resetting extraction tracking without deleting memories,
so the next extraction re-reads all messages from the beginning.
Useful after manually editing or deleting memories.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 21:39:02 -08:00
bal-spec
f1e6789dfa Add consolidation preview and undo
Show a side-by-side Before/After preview popup before applying
consolidation results, and add an Undo Consolidation button that
restores the pre-consolidation memories from an in-memory backup.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 21:34:27 -08:00
bal-spec
93c6f7e94d Redesign memory format to <memory> tags, add per-bullet manager UX and vectorization diagnostics
Switch from ## Memory N headers to <memory chat="..." date="..."> tag blocks
with individual bullet parsing. Memory manager now shows grouped extraction
cards with per-bullet edit/delete controls. Stats bar simplified to file name
and total bullet count. Diagnostics panel shows vectorization status.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 20:03:55 -08:00
bal-spec
2e4ba2c936 Improve UX: rename to Character Memory, add stats bar, flatten layout
- Rename extension header from CharMemory to Character Memory
- Add always-visible stats bar showing active file, memory count, and
  extraction progress
- Flatten Memory Status sub-drawer so controls are immediately visible
- Merge Advanced section into Settings with separator dividers
- Rename buttons: Manage Memories → View / Edit, Reset → Clear All
  Memories (moved to Settings with danger styling)
- Add tooltips, helper text styling, and separator/danger-button CSS
- Call updateStatusDisplay after consolidation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 19:50:34 -08:00
bal-spec
ef21f694d3 Add per-character file naming, per-chat toggle, and memory diagnostics
Auto-generate memory file names from character name (CharName-memories.md),
with optional per-chat isolation (CharName-chat{id}-memories.md). Add memory
info to diagnostics panel showing active file, memory count, and last
extraction result. Migrate old hardcoded 'char-memories.md' default to
auto-naming.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 19:27:23 -08:00