A. Orientation
What this page is
The AI Phrase Generator is a personal exploration tool that helps you generate harmonic phrases through a guided conversation with an AI. The AI uses a custom prompt (ai-prompt.txt) that knows how to translate descriptions of what you're noticing into phrases following a specific grammar. The output is meant to be played back through the Phrase Player.
What this page is NOT
This is not a medical tool. It does not diagnose, treat, cure, or prevent any condition. The signals it captures (typing rhythm, voice features) are not validated indicators of any clinical state. Interpretations the AI applies to these signals are heuristic, not science. This page exists for personal exploration only β it is not for sale and not intended for others to use as guidance.
Relationship to the Phrase Player
The Phrase Player is the playback half of this system. It contains a library of pre-written phrases organized by category, plus a custom playlist textarea where you can drop any phrases you want to convert to sound. The AI Phrase Generator is the creation half β it produces new phrases tailored to what you're currently exploring. Phrases generated here can be sent directly to the Player's playlist via the "Send to Phrase Player" button.
Quick start
- Configure API access. Open Config / API Settings, paste your OpenAI key. The key lives in your browser only.
- Typing rhythm (optional). Leave the Keyboard (and optionally Mouse) channel on if you want your keystroke/mouse dynamics sent to the AI as live per-turn context. No setup needed.
- Start a chat. Type a description of what you're noticing. The AI will ask clarifying questions.
- Review phrases. The AI generates 5β10 phrases. Accept what fits with phrase numbers + a path letter ("1, 3 β a" to refine; "e" to let the AI suggest where to go next).
- Accepted phrases auto-save. Phrases you accept in chat are added to your library automatically β no separate save step needed.
- Send to Player. In the Accumulated Phrases section, click Send to Phrase Player. Your phrases get appended to the Player's playlist without overwriting anything already there.
B. How AI context signals work
The 6-modality vision
The page is designed around the premise that multiple independent signal channels may, together, give the AI better context than any single one. Several channels are envisioned. Today the active ones are your description (words), keyboard rhythm, mouse movement, and voice (carried from the Prioritizer). Facial movement, HRV, and GSR are reserved for future builds.
Modality 1 β Self-report (always on)
Your typed words and chat answers. The primary signal. The AI weights this above all other signals when they conflict. There is no calibration, no toggle β words are how the AI primarily understands what you're exploring.
Modality 2 β Typing rhythm (keys + pointer)
Captures: keys per second, percentage of backspaces, mean inter-keystroke gap, mouse speed, mouse jitter, mouse pause count. Read passively as you type and move the mouse. Both subchannels feed the AI as a single bracketed metadata line.
Bracket-line gate: typing data is included only if at least 10 keystrokes were captured over at least 3 seconds. Mouse data requires at least 5 samples over 2 seconds.
Modality 3 β Voice (carried from the Prioritizer)
Vocal dynamics from a short recording on the Prioritizer β average pitch and how much it moves, energy, pace, and silence β plus your voice calibration. Captures how your voice moves, not what you say (no transcription). Voice is recorded on the Prioritizer and carried here as read-only context; on this page it's the one channel you can toggle on or off. Keyboard, Words, and Mouse are always on.
Future modalities (not yet built)
- Facial movement: head pose, blink rate, micro-movement variance via webcam.
- HRV / GSR: heart-rate variability and galvanic skin response via external sensors. Require hardware.
Privacy
All signal processing happens in your browser. Typing and mouse metrics are computed locally and only the small bracketed summary line is sent to the AI with your message. No raw keystrokes or recordings leave your device. Future camera/sensor channels (when built) will follow the same fully-local pattern.
The API key, typing baselines, and accumulated phrases all live in your browser's localStorage on this device only. Clearing browser data wipes everything. Using a different browser or device starts fresh.
Honest note on signal validity
The interpretations applied to typing-rhythm and mouse features are heuristic, not validated. Faster typing doesn't reliably indicate "activation" across people or contexts. The page captures these signals because they're available and may carry useful information at the margins, but you should not treat the AI's responses as informed by any kind of clinical or scientific assessment of your state. Your typed words are the primary signal; everything else is secondary. This is exploration, not diagnosis.
C. How signals influence phrase generation
The bracket-line context
When you send a chat turn with signal toggles on, the page prepends a bracketed metadata line to your message before sending it to the AI. A typical line looks like:
[Input dynamics this turn β typing: 4.85 kps, 1.6% backspaces, 198 ms gap mean over 14s Β· mouse: 220 px/s, jitter 0.55, 4 pauses over 15s]
This line is INVISIBLE in the chat thread's main view β it's collapsed under a "βΈ context sent this turn" expander that you can click to inspect. The AI sees it. The AI never quotes it back at you.
How the AI sees signals
The AI's system prompt includes the base doctrine (ai-prompt.txt) plus an addendum that teaches it how to interpret the bracket-line context. The addendum has interpretation rules (what high typing-rhythm variance might suggest, etc.) and strict prohibitions: the AI must never quote the features back, never label your state, and never make confident claims about what the signals "show."
Words are primary
Your typed words and chat answers are the primary signal β the AI weights them above all else. Typing-rhythm and mouse metrics are background context only: they may modestly color the AI's clarifying questions or (e) suggestions, but they never override your words and never drive a visible routing decision. When in doubt, the words win.
What the AI never does with signals
- Never labels your state ("you seem stressed," "you sound calm").
- Never quotes the numeric features back at you.
- Never asks about your typing rhythm directly.
- Never uses signals to override your typed words. Words are primary.
- Never makes a routing decision visible. Signals shift weighting; they don't replace your input.
D. How the AI prompt works
The base prompt: ai-prompt.txt
The file ai-prompt.txt on your server is the AI's primary instruction set. It defines the phrase grammar, the conversation flow, and the constraints on output voice. The page fetches it at load time and caches it in localStorage. If the file is updated on the server, the new version takes effect after the next page reload.
The 13 semantic directions (internal taxonomy)
The doctrine routes user descriptions into one of 13 internal semantic directions (Anatomical, Ecological, Environmental, Material/chemical, Inflammatory, Structural, Signal/informational, Biofield/energetic, Symbolic/archetypal, Temporal/generational, Emotional/limbic, Nutritional/input, Homeopathic/constitutional). The AI never names these directions to you. The taxonomy is internal bookkeeping that helps the AI choose appropriate vocabulary for the phrases it generates.
Two phrase grammars
Two grammars are supported, chosen by the AI based on what you describe:
- Specific/bounded: phrases that address something specific and bounded (e.g., "Residual Sinus Congestion Resolution").
- Architectural: phrases that address larger patterns or systems (e.g., "Residual Inflammatory Response Architecture").
The AI infers which grammar (or both) is appropriate from your description and uses that vocabulary internally. You won't see grammar labels in the output.
The conversation flow
- Description. You describe what you're noticing.
- Clarifying questions. The AI asks numbered questions with lettered options. You answer with combined codes ("1a 2c 3b").
- Phrase batch. The AI generates 5β10 numbered phrases plus a 2β3 sentence reflection on what the phrases focus on.
- Path reply. You respond with phrase numbers plus a path letter (e.g., "1, 3 β a").
- Loop or finalize. The AI proceeds based on the path letter.
The path letters
- (a) Refine these further. The AI takes the phrases you accepted and produces variations.
- (b) Explore a different aspect. The AI pivots to a different angle within the same description.
- (c) See the full working set. The AI displays all phrases accepted so far in this conversation.
- (d) Finalize this as the set. The AI wraps the session and confirms the working set.
- (e) Suggest where to go next. The AI proposes 3β5 numbered refinement directions for you to pick from. Use this when you're not sure what to do next.
About path (e) specifically
(e) is the AI-driven path. The other letters (a, b) leave it to you to direct the next move. (e) hands the wheel back to the AI: "I don't know what to pick β give me options."
Rules the AI follows for (e):
- Each suggested direction must be specific enough that you can predict what kind of phrases would result. ("Phrases addressing whether X is sustaining Y" β good. "Investigate environmental influences" β too vague.)
- "Something else β describe in your own words" is always the final numbered option (not a trailing sentence).
- From the second (e) onward in a conversation, a "Return to your original framing" option appears as the second-to-last numbered option. This gives you a path back if recent pivots have drifted from your initial concern.
- The AI uses any available signal context the same way it would on any other turn β background information, not a primary driver.
The addendum
When the typing-rhythm or mouse channel is on, the page appends an addendum to the AI's system prompt. The addendum teaches the AI how to read the bracket-line context, defines what the AI must never do with signals (no quoting, no labeling, no diagnostic claims), and defines the path (e) rules. It stays self-contained β it works whichever version of ai-prompt.txt is loaded.
v15 β v16 changes
v16 of ai-prompt.txt adds: a BATCH VARIETY rule (each batch must spread across distinct facets and vary its structure and vocabulary, rather than rotating a single interior word); an expanded (b) "explore a different aspect" path so it pivots to a genuinely different facet instead of repeating; and number-parsing tolerance so loose selection input ("1,36,7", "135", ranges) is read forgivingly.
E. How accumulated phrases work
Working set vs. accumulator
Two different stores:
- Working set. Phrases you've accepted in the current chat session. Lives in the AI's conversation context and on your device until you reset the session. Accessible via path (c) "see full working set."
- Accumulator (Library). Phrases you've explicitly saved across all sessions. Lives in localStorage. Survives page reloads. Shown in the "Library / Accumulated phrases" section.
Auto-save to Library
Phrases you accept in chat (by replying with numbers, "all," or "1, 3 β a") are automatically added to your library after each AI response. A small toast confirms additions: "β N phrases added to library." Phrases dedupe by exact text β duplicates are silently skipped. If you change your mind on a phrase, remove it from the Accumulated Phrases section using the per-phrase Γ link. The library is your source of truth; the AI's working set in conversation is just a parallel view.
Send to Phrase Player
In the Library section, click "Send to Phrase Player." The page writes your accumulated phrases to a shared localStorage handoff key and navigates to index.html. The Phrase Player reads the key on load, appends the phrases to its Phrase Playlist textarea (it never overwrites what's already there), dedupes case-insensitively against existing lines, clears the key, and shows a green toast: "β Added N phrases from AI Phrase Generator (Beta)."
The append-only rule is strict: whatever you had in the Phrase Player's playlist before the handoff stays exactly as it was. New phrases land below the existing content.
Copy as Text
Alternative to the Send to Phrase Player handoff. Copies all accumulated phrases to your clipboard, one per line. Useful for pasting elsewhere β into a notes file, an email, another tool.
Clear All
Wipes the entire accumulator. Confirmation prompt first. This is permanent.
Storage scope
The accumulator lives in this browser's localStorage on this device. Using a different browser or device starts you fresh. Clearing browser data wipes everything.
F. Reference
localStorage keys used
phrasefinder:openai_key:v1 β your OpenAI API key
phrasefinder:openai_model:v1 β selected model (gpt-5.5 or gpt-5.4-mini)
phrasefinder:keystroke_baselines:v1 β three typing baseline recordings
phrasefinder:voice_profile:v2 β rolling buffer of voice calibration features
phrasefinder:ai_prompt_cache:v1 β cached ai-prompt.txt content
phrasefinder:generated_phrases:v1 β accumulated phrases
harmonic:handoff:incoming_phrases:v1 β one-shot handoff to Phrase Player (cleared after consumption)
Cost per turn
- Each chat turn: roughly $0.001 with
gpt-5.4-mini, or $0.01β0.03 with gpt-5.5
- Typing/mouse capture: no cost β computed fully locally
- Session-cumulative cost shown inside Config / API Settings
Known limitations
- Voice is active as an editable channel β it carries vocal dynamics from a Prioritizer recording plus your calibration; uncheck it to leave voice out.
- Typing rhythm baselines (focused/scattered/relaxed) are recorded on the page but aren't currently sent to the AI in real time β only the live per-turn metrics are sent. Baselines exist for future use.
- The interpretation rules for signals are heuristic. They are not validated for any individual, and you should not treat AI responses as informed by clinical assessment.
- Three modalities (Facial, HRV, GSR) are listed but not implemented.
- The handoff to Phrase Player works only when both pages are on the same origin (same domain). On Netlify (naturalisthome.com) this works; running locally with
file:// URLs does not.
Diagnostic logging
The page logs signal-flow diagnostics to the browser DevTools console on every chat turn. Open the Console tab in DevTools to see what bracket-line context is being sent (or why none is being sent). Invisible to normal use; useful when something looks off.
Resetting
- Reset Chat (in chat action row): wipes the current chat session, session cost, and resets signal toggles to defaults (both on). Preserves the accumulator and API key.
- Clear All Stored Data (in Config / API Settings): clears everything in localStorage, including API key. Use this when starting fresh.