implemented offline cache #1

Merged
finn merged 9 commits from caching into master 2026-01-03 04:46:17 +00:00
7 changed files with 151 additions and 199 deletions
Showing only changes of commit 17b5646268 - Show all commits

View File

@@ -16,5 +16,6 @@ As the user discards prompts, the themes will be very slowly steered, so it's ok
Expected Output:
Output as a JSON list with the requested number of elements.
Despite the provided history being a keyed list or dictionary, the expected return JSON will be a simple list with no keys.
Respond ONLY with valid JSON. No explanations, no markdown, no backticks.

View File

@@ -1,25 +0,0 @@
Payload
The previous 60 prompts have been provided as a JSON array for reference.
Guidelines
Topics should be diverse.
Generate 6 writing prompts in English.
Each prompt should include a few guidelines or questions to inspire writing.
Prompts are meant to inspire one to two pages of writing in a journal as an exercise.
Each prompt should be between 500 and 1000 characters in length.
Prompt History Considerations
The history helps reduce repetition, but some thematic overlap is acceptable.
Try harder to avoid overlap with prompts at lower indices in the array.
As the user discards prompts, themes will slowly steer, so it's okay to take some inspiration from the history.
Expected Output
Output must be a JSON array with keys from "newprompt0" to "newprompt5" in the case of 6 prompts.
Respond ONLY with valid JSON. No explanations, no markdown, no backticks.

View File

@@ -1,20 +0,0 @@
Request for generation of writing prompts for journaling
Payload:
The previous 60 prompts have been provided as a JSON array for reference.
Guidelines:
Topics can be diverse.
Please generate 6 writing prompts in English with a few guidelines.
These are meant to inspire one to two pages of writing in a journal as exercise.
The prompts should be between 500 and 1000 characters in length.
Prompt History:
The provided history brackets two mechanisms.
The history will allow for reducing repetition, however some thematic overlap is acceptable. Try harder to avoid overlap with lower indices in the array.
As the user discards prompts, the themes will be very slowly steered, so it's okay to take some inspiration from it.
Expected Output:
Output as a JSON array with key names from "newprompt0" to "newpromptN" where N is the number of prompts minus one.
Respond ONLY with valid JSON. No explanations, no markdown, no backticks.

View File

@@ -166,17 +166,13 @@ class JournalPromptGenerator:
def add_prompts_to_pool(self, prompts: List[str]):
"""Add generated prompts to the pool."""
for prompt_text in prompts:
# Add to pool with a pool-specific key
pool_key = f"poolprompt{len(self.pool_prompts):03d}"
self.pool_prompts.append({
pool_key: prompt_text
})
# Simply extend the pool with the new prompts (no keys)
self.pool_prompts.extend(prompts)
self._save_pool_prompts()
self.console.print(f"[green]Added {len(prompts)} prompts to pool[/green]")
def draw_prompts_from_pool(self, count: int = None) -> List[Dict[str, str]]:
def draw_prompts_from_pool(self, count: int = None) -> List[str]:
"""Draw prompts from the pool (removes them from pool)."""
if count is None:
count = self.settings['num_prompts']
@@ -196,26 +192,8 @@ class JournalPromptGenerator:
# Save updated pool
self._save_pool_prompts()
# Renumber remaining pool prompts
self._renumber_pool_prompts()
return drawn_prompts
def _renumber_pool_prompts(self):
"""Renumber pool prompts to maintain sequential numbering."""
renumbered_prompts = []
for i, prompt_dict in enumerate(self.pool_prompts):
# Get the prompt text from the first key in the dictionary
prompt_key = list(prompt_dict.keys())[0]
prompt_text = prompt_dict[prompt_key]
# Create new prompt with correct numbering
new_prompt_key = f"poolprompt{i:03d}"
renumbered_prompts.append({
new_prompt_key: prompt_text
})
self.pool_prompts = renumbered_prompts
def show_pool_stats(self):
"""Show statistics about the prompt pool."""
@@ -394,64 +372,6 @@ class JournalPromptGenerator:
return new_prompts
except json.JSONDecodeError:
# If not valid JSON, try to extract prompts from text
self.console.print("[yellow]Warning: AI response is not valid JSON, attempting to extract prompts...[/yellow]")
self.console.print(f"[yellow]Full response content for debugging:[/yellow]")
self.console.print(f"[yellow]{response_content}[/yellow]")
self.console.print(f"[yellow]Cleaned content: {cleaned_content}[/yellow]")
# Look for patterns in the text
lines = response_content.strip().split('\n')
new_prompts = []
for i, line in enumerate(lines[:self.settings['num_prompts']]): # Take first N non-empty lines
line = line.strip()
if line and len(line) > 50: # Reasonable minimum length for a prompt
prompt_obj = {
f"prompt{len(self.historic_prompts) + i:02d}": line
}
new_prompts.append(prompt_obj)
# If still no prompts could be parsed, provide detailed debug information
if not new_prompts:
self.console.print("\n[red]ERROR: Could not extract any prompts from AI response[/red]")
self.console.print("[red]="*60 + "[/red]")
self.console.print("[bold red]DEBUG INFORMATION:[/bold red]")
self.console.print("[red]="*60 + "[/red]")
# Show response metadata
self.console.print(f"[yellow]Response length: {len(response_content)} characters[/yellow]")
self.console.print(f"[yellow]Expected number of prompts: {self.settings['num_prompts']}[/yellow]")
# Show first 500 characters of response
preview = response_content[:500]
if len(response_content) > 500:
preview += "..."
self.console.print(f"[yellow]Response preview (first 500 chars):[/yellow]")
self.console.print(f"[yellow]{preview}[/yellow]")
# Show cleaned content analysis
self.console.print(f"[yellow]Cleaned content length: {len(cleaned_content)} characters[/yellow]")
self.console.print(f"[yellow]Cleaned content preview: {cleaned_content[:200]}...[/yellow]")
# Show line analysis
self.console.print(f"[yellow]Number of lines in response: {len(lines)}[/yellow]")
self.console.print(f"[yellow]First 5 lines:[/yellow]")
for i, line in enumerate(lines[:5]):
self.console.print(f"[yellow] Line {i+1}: {line[:100]}{'...' if len(line) > 100 else ''}[/yellow]")
# Show JSON parsing attempt details
self.console.print(f"[yellow]JSON parsing attempted on cleaned content:[/yellow]")
self.console.print(f"[yellow] Cleaned content starts with: {cleaned_content[:50]}...[/yellow]")
# Show full payload for debugging
self.console.print("\n[bold red]FULL PAYLOAD DUMP:[/bold red]")
self.console.print("[red]" + "="*60 + "[/red]")
self.console.print(f"[red]{response_content}[/red]")
self.console.print("[red]" + "="*60 + "[/red]")
return new_prompts
def _clean_ai_response(self, response_content: str) -> str:
"""
@@ -542,18 +462,14 @@ class JournalPromptGenerator:
return new_prompts
def display_prompts(self, prompts: List[Dict[str, str]]):
def display_prompts(self, prompts: List[str]):
"""Display generated prompts in a nice format."""
self.console.print("\n" + "="*60)
self.console.print("[bold green]✨ READING FROM POOL ✨[/bold green]")
self.console.print("="*60 + "\n")
for i, prompt_dict in enumerate(prompts, 1):
# Extract prompt text (key is like "prompt60", "prompt61", etc.)
prompt_key = list(prompt_dict.keys())[0]
prompt_text = prompt_dict[prompt_key]
# Create a panel for each prompt
for i, prompt_text in enumerate(prompts, 1):
# Create a panel for each prompt with UI numbering
panel = Panel(
f"[cyan]{prompt_text}[/cyan]",
title=f"[bold]Prompt #{i}[/bold]",
@@ -610,9 +526,7 @@ class JournalPromptGenerator:
)
prompt_idx = int(prompt_num) - 1
prompt_dict = drawn_prompts[prompt_idx]
prompt_key = list(prompt_dict.keys())[0]
prompt_text = prompt_dict[prompt_key]
prompt_text = drawn_prompts[prompt_idx]
# Save to file
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")

View File

@@ -1,182 +1,182 @@
[
{
"prompt00": "Recall a public space you frequented often in the past but have not visited in years (a library, a park, a diner, a store). Reconstruct it from memory in vivid detail. Then, imagine returning to it today. Describe the inevitable changes\u2014the renovations, the new faces, the faded paint. But also, hunt for the one thing that remains exactly, miraculously the same. How does the coexistence of change and permanence in this space make you feel about the passage of your own time?"
"prompt00": "Observe the sky right now, in this exact moment. Describe its color, cloud formations, light quality, and movement with meticulous attention. Then, let this observation launch you into a reflection on scale and perspective. Consider the atmospheric phenomena occurring beyond your sight\u2014jet streams, weather systems, celestial motions. How does contemplating the vast, impersonal sky make you feel about your current concerns, joys, or plans? Write about the tension between the immediacy of your personal world and the silent, ongoing spectacle above."
},
{
"prompt01": "\"newprompt3\": \"Recall a teacher, mentor, or elder who said something to you in passing that you have never forgotten. It might have been a compliment, a criticism, or an offhand observation. Reconstruct the scene. Why did their words carry such weight? How have you turned them over in your mind since? Explore the power of brief, seemingly casual utterances to shape a person's self-concept.\","
"prompt01": "Choose a machine or appliance in your home that has a distinct sound\u2014a refrigerator hum, a heater's click, a fan's whir. Close your eyes and listen to it for a full minute. Describe its rhythm, pitch, and constancy. Now, personify this sound. What is its personality? Is it a loyal guardian, a complaining old friend, a distant observer? Write a monologue from its perspective about the life it monitors within these walls. What has it learned about you from its unchanging post?"
},
{
"prompt02": "\"newprompt0\": \"Write a detailed portrait of a tree you know well\u2014not just its appearance, but its history in that spot, the way its branches move in different winds, the creatures that inhabit it, the shadows it casts at various hours. Imagine its perspective across seasons and years. What has it witnessed? What would it say about change, resilience, or stillness if it could speak? Let the tree become a mirror for your own sense of place and time.\","
"prompt02": "Recall a public space you frequented often in the past but have not visited in years (a library, a park, a diner, a store). Reconstruct it from memory in vivid detail. Then, imagine returning to it today. Describe the inevitable changes\u2014the renovations, the new faces, the faded paint. But also, hunt for the one thing that remains exactly, miraculously the same. How does the coexistence of change and permanence in this space make you feel about the passage of your own time?"
},
{
"prompt03": "Describe a memory you have that is tied to a specific smell. Don't just tell the story of the event; focus on describing the scent itself in as much detail as possible\u2014its texture, its weight in the air, its nuances. How does conjuring that smell now make you feel in your body? Let the description of the aroma lead you back into the memory's landscape."
"prompt03": "\"newprompt3\": \"Recall a teacher, mentor, or elder who said something to you in passing that you have never forgotten. It might have been a compliment, a criticism, or an offhand observation. Reconstruct the scene. Why did their words carry such weight? How have you turned them over in your mind since? Explore the power of brief, seemingly casual utterances to shape a person's self-concept.\","
},
{
"prompt04": "Write a letter to your 15-year-old self. Be kind, be blunt, be humorous, or be stern. What do you know now that you desperately needed to hear then? What mystery about your future life could you tantalizingly hint at without giving it all away? Don't just give advice; try to capture the voice and tone you wish an older, wiser person had used with you."
"prompt04": "\"newprompt0\": \"Write a detailed portrait of a tree you know well\u2014not just its appearance, but its history in that spot, the way its branches move in different winds, the creatures that inhabit it, the shadows it casts at various hours. Imagine its perspective across seasons and years. What has it witnessed? What would it say about change, resilience, or stillness if it could speak? Let the tree become a mirror for your own sense of place and time.\","
},
{
"prompt05": "You find a forgotten door in a place you know well\u2014your home, your workplace, your daily park. It wasn't there yesterday. You open it. Describe what is on the other side using only sensory details: sight, sound, temperature, smell. Do not explain its purpose or origin. Simply document the experience of crossing that threshold."
"prompt05": "Describe a memory you have that is tied to a specific smell. Don't just tell the story of the event; focus on describing the scent itself in as much detail as possible\u2014its texture, its weight in the air, its nuances. How does conjuring that smell now make you feel in your body? Let the description of the aroma lead you back into the memory's landscape."
},
{
"prompt06": "Make a list of ten tiny, perfect moments from the past month that no one else probably noticed or would remember. The way light fell on a spoon, a stranger's half-smile, the sound of rain stopping. Elaborate on at least three of them, expanding them into full vignettes. Why did these micro-moments stick with you?"
"prompt06": "Write a letter to your 15-year-old self. Be kind, be blunt, be humorous, or be stern. What do you know now that you desperately needed to hear then? What mystery about your future life could you tantalizingly hint at without giving it all away? Don't just give advice; try to capture the voice and tone you wish an older, wiser person had used with you."
},
{
"prompt07": "Invent a mythological creature for a modern urban setting. What does it look like? What is its behavior and habitat (e.g., subway tunnels, server farms, air vents)? What folklore do people whisper about it? What does it symbolize\u2014anxiety, forgotten connections, hope? Describe a recent 'sighting' of this creature in vivid detail."
"prompt07": "You find a forgotten door in a place you know well\u2014your home, your workplace, your daily park. It wasn't there yesterday. You open it. Describe what is on the other side using only sensory details: sight, sound, temperature, smell. Do not explain its purpose or origin. Simply document the experience of crossing that threshold."
},
{
"prompt08": "Choose an object in your immediate line of sight that is not electronic. Write its biography. Where was it made? Who owned it before you? What conversations has it overheard? What secrets does it hold? What small damages or wear marks does it have, and what story does each tell? Give this ordinary item an epic history."
"prompt08": "Make a list of ten tiny, perfect moments from the past month that no one else probably noticed or would remember. The way light fell on a spoon, a stranger's half-smile, the sound of rain stopping. Elaborate on at least three of them, expanding them into full vignettes. Why did these micro-moments stick with you?"
},
{
"prompt09": "Describe your current emotional state as a weather system. Is it a still, high-pressure fog? A sudden, sharp hailstorm? A lingering, humid drizzle? Map its boundaries, its intensity, its forecast. What terrain does it move over\u2014the mountains of your responsibilities, the plains of your routine? How does it affect your internal climate?"
"prompt09": "Invent a mythological creature for a modern urban setting. What does it look like? What is its behavior and habitat (e.g., subway tunnels, server farms, air vents)? What folklore do people whisper about it? What does it symbolize\u2014anxiety, forgotten connections, hope? Describe a recent 'sighting' of this creature in vivid detail."
},
{
"prompt10": "Recall a time you were deeply embarrassed. Write about it from the perspective of a sympathetic observer who was there\u2014or invent one. How might they have perceived the event? What context or kindness might they have seen that you, in your self-focused shame, completely missed? Reframe the memory through their eyes."
"prompt10": "Choose an object in your immediate line of sight that is not electronic. Write its biography. Where was it made? Who owned it before you? What conversations has it overheard? What secrets does it hold? What small damages or wear marks does it have, and what story does each tell? Give this ordinary item an epic history."
},
{
"prompt11": "What skill or craft have you always wanted to learn but haven't? Immerse yourself in a detailed fantasy of mastering it. Describe the feel of the tools in your hands, the initial frustrations, the first small success, the growing muscle memory. What does the final, perfected product of your labor look or feel like? Live in that imagined\u6210\u5c31\u611f."
"prompt11": "Describe your current emotional state as a weather system. Is it a still, high-pressure fog? A sudden, sharp hailstorm? A lingering, humid drizzle? Map its boundaries, its intensity, its forecast. What terrain does it move over\u2014the mountains of your responsibilities, the plains of your routine? How does it affect your internal climate?"
},
{
"prompt12": "Write a dialogue between two aspects of yourself (e.g., Your Ambitious Self and Your Tired Self; Your Cynical Self and Your Hopeful Self). Give them distinct voices. What are they arguing about, negotiating, or planning? Don't just state positions; let them bicker, persuade, or sit in silence together. See where the conversation goes."
"prompt12": "Recall a time you were deeply embarrassed. Write about it from the perspective of a sympathetic observer who was there\u2014or invent one. How might they have perceived the event? What context or kindness might they have seen that you, in your self-focused shame, completely missed? Reframe the memory through their eyes."
},
{
"prompt13": "Describe your childhood home from the perspective of a small animal (a mouse, a squirrel, a bird) that lived there concurrently with you. What did this creature notice about your family's rhythms, the layout, the dangers, and the treasures (crumbs, cozy materials)? How did it perceive you, the giant human child?"
"prompt13": "What skill or craft have you always wanted to learn but haven't? Immerse yourself in a detailed fantasy of mastering it. Describe the feel of the tools in your hands, the initial frustrations, the first small success, the growing muscle memory. What does the final, perfected product of your labor look or feel like? Live in that imagined\u6210\u5c31\u611f."
},
{
"prompt14": "List five paths your life could have taken if you'd made one different choice. Briefly outline each alternate reality. Then, choose one and dive deep: write a journal entry from that version of you today. What are their worries, joys, and regrets? How is their voice similar to or different from your own?"
"prompt14": "Write a dialogue between two aspects of yourself (e.g., Your Ambitious Self and Your Tired Self; Your Cynical Self and Your Hopeful Self). Give them distinct voices. What are they arguing about, negotiating, or planning? Don't just state positions; let them bicker, persuade, or sit in silence together. See where the conversation goes."
},
{
"prompt15": "Think of a person you see regularly but do not know (a barista, a neighbor, a commuter). Invent a rich, secret inner life for them. What profound private mission are they on? What hidden talent do they possess? What great sorrow or hope are they carrying today as they serve your coffee or stand on the platform? Write from their perspective."
"prompt15": "Describe your childhood home from the perspective of a small animal (a mouse, a squirrel, a bird) that lived there concurrently with you. What did this creature notice about your family's rhythms, the layout, the dangers, and the treasures (crumbs, cozy materials)? How did it perceive you, the giant human child?"
},
{
"prompt16": "What is a belief you held strongly five or ten years ago that you have since questioned or abandoned? Trace the evolution of that change. Was it a sudden shattering or a slow erosion? What person, experience, or piece of information was the catalyst? Describe the feeling of the ground shifting under that particular piece of your worldview."
"prompt16": "List five paths your life could have taken if you'd made one different choice. Briefly outline each alternate reality. Then, choose one and dive deep: write a journal entry from that version of you today. What are their worries, joys, and regrets? How is their voice similar to or different from your own?"
},
{
"prompt17": "Describe a common, mundane process (making tea, tying your shoes, doing laundry) in extreme, almost absurdly epic detail, as if you were writing a sacred manual or a scientific treatise for an alien civilization. Break down every micro-action, every sensation, every potential variable. Find the profound in the procedural."
"prompt17": "Think of a person you see regularly but do not know (a barista, a neighbor, a commuter). Invent a rich, secret inner life for them. What profound private mission are they on? What hidden talent do they possess? What great sorrow or hope are they carrying today as they serve your coffee or stand on the platform? Write from their perspective."
},
{
"prompt18": "You are given a suitcase and told you must leave your home in one hour, not knowing if or when you'll return. You can only take what fits in the case. Describe, in real-time, the frantic and deliberate process of choosing. What practical items make the cut? What irreplaceable tokens? What do you leave behind, and what does that feel like?"
"prompt18": "What is a belief you held strongly five or ten years ago that you have since questioned or abandoned? Trace the evolution of that change. Was it a sudden shattering or a slow erosion? What person, experience, or piece of information was the catalyst? Describe the feeling of the ground shifting under that particular piece of your worldview."
},
{
"prompt19": "Write about water in three different forms: as a memory involving a body of water (ocean, river, bath), as a description of drinking a glass of water right now, and as a metaphor for an emotion. Move seamlessly between these three aspects. Let the fluidity of the theme connect them."
"prompt19": "Describe a common, mundane process (making tea, tying your shoes, doing laundry) in extreme, almost absurdly epic detail, as if you were writing a sacred manual or a scientific treatise for an alien civilization. Break down every micro-action, every sensation, every potential variable. Find the profound in the procedural."
},
{
"prompt20": "What does silence sound like in your current environment? Don't just say 'quiet.' Describe the layers of sound that actually constitute the silence\u2014the hums, ticks, distant rumbles, the sound of your own body. Now, project what this same space sounded like 100 years ago, and what it might sound like 100 years from now."
"prompt20": "You are given a suitcase and told you must leave your home in one hour, not knowing if or when you'll return. You can only take what fits in the case. Describe, in real-time, the frantic and deliberate process of choosing. What practical items make the cut? What irreplaceable tokens? What do you leave behind, and what does that feel like?"
},
{
"prompt21": "Create a recipe for a dish that represents your current life phase. List ingredients (e.g., \"two cups of transition,\" \"a pinch of anxiety,\" \"a steady base of routine\"). Write the instructions, including the method, cooking time, and necessary equipment. Describe the final product's taste, texture, and who it should be shared with."
"prompt21": "Write about water in three different forms: as a memory involving a body of water (ocean, river, bath), as a description of drinking a glass of water right now, and as a metaphor for an emotion. Move seamlessly between these three aspects. Let the fluidity of the theme connect them."
},
{
"prompt22": "Recall a dream from the past week, however fragmentary. Don't interpret it. Instead, expand it. Continue the narrative from where it left off. Describe the dream logic, the landscape, the characters. Let it become a story. Where does your dreaming mind take you when given free rein on the page?"
"prompt22": "What does silence sound like in your current environment? Don't just say 'quiet.' Describe the layers of sound that actually constitute the silence\u2014the hums, ticks, distant rumbles, the sound of your own body. Now, project what this same space sounded like 100 years ago, and what it might sound like 100 years from now."
},
{
"prompt23": "Make a list of everything that is blue in your immediate environment. Describe each shade specifically (slate, cobalt, robin's egg, faded denim). Then, choose one blue object and write about its journey to being here, in this blue state, in front of you. How did it get its color? What has it reflected?"
"prompt23": "Create a recipe for a dish that represents your current life phase. List ingredients (e.g., \"two cups of transition,\" \"a pinch of anxiety,\" \"a steady base of routine\"). Write the instructions, including the method, cooking time, and necessary equipment. Describe the final product's taste, texture, and who it should be shared with."
},
{
"prompt24": "Write a eulogy for something you've lost that isn't a person\u2014a habit, a version of a city, a relationship dynamic, a part of your identity. Acknowledge its virtues and its flaws. Say goodbye properly, with humor, regret, and gratitude. What did it give you? What space has its departure created?"
"prompt24": "Recall a dream from the past week, however fragmentary. Don't interpret it. Instead, expand it. Continue the narrative from where it left off. Describe the dream logic, the landscape, the characters. Let it become a story. Where does your dreaming mind take you when given free rein on the page?"
},
{
"prompt25": "Describe your hands. Not just their appearance, but their capabilities, their scars, their memories. What have they held, built, comforted, or torn down? What do their specific aches and strengths tell you about the life you've lived so far? If your hands could speak, what would they say they want to do next?"
"prompt25": "Make a list of everything that is blue in your immediate environment. Describe each shade specifically (slate, cobalt, robin's egg, faded denim). Then, choose one blue object and write about its journey to being here, in this blue state, in front of you. How did it get its color? What has it reflected?"
},
{
"prompt26": "Imagine you can overhear the conversation of the people at the table next to you in a caf\u00e9, but they are speaking in a language you don't understand. Based on their tone, gestures, pauses, and expressions, invent the dialogue. What crucial, funny, or tragic misunderstanding are they having? What are they *really* talking about?"
"prompt26": "Write a eulogy for something you've lost that isn't a person\u2014a habit, a version of a city, a relationship dynamic, a part of your identity. Acknowledge its virtues and its flaws. Say goodbye properly, with humor, regret, and gratitude. What did it give you? What space has its departure created?"
},
{
"prompt27": "What is a piece of art (a song, painting, film, book) that fundamentally moved you? Describe the first time you encountered it. Don't just analyze why it's good; describe the physical and emotional reaction it provoked. Has its meaning changed for you over time? How does it live inside you now?"
"prompt27": "Describe your hands. Not just their appearance, but their capabilities, their scars, their memories. What have they held, built, comforted, or torn down? What do their specific aches and strengths tell you about the life you've lived so far? If your hands could speak, what would they say they want to do next?"
},
{
"prompt28": "You have one day completely alone, with no obligations and no possibility of communication. The power and internet are out. How do you spend the hours from waking to sleeping? Detail the rituals, the wanderings, the thoughts, the meals. Do you enjoy the solitude or chafe against it? What arises in the quiet?"
"prompt28": "Imagine you can overhear the conversation of the people at the table next to you in a caf\u00e9, but they are speaking in a language you don't understand. Based on their tone, gestures, pauses, and expressions, invent the dialogue. What crucial, funny, or tragic misunderstanding are they having? What are they *really* talking about?"
},
{
"prompt29": "Personify a negative emotion you've been feeling lately (e.g., anxiety, envy, restlessness). Give it a name, a form, a voice. Write a character profile of it. What does it want? What does it fear? What flawed logic does it operate under? Then, write a short scene of you having a cup of tea with it, listening to its perspective."
"prompt29": "What is a piece of art (a song, painting, film, book) that fundamentally moved you? Describe the first time you encountered it. Don't just analyze why it's good; describe the physical and emotional reaction it provoked. Has its meaning changed for you over time? How does it live inside you now?"
},
{
"prompt30": "Describe a city you've never been to, based solely on the stories, images, and snippets you've absorbed about it. Build it from imagination and second-hand clues. Then, contrast that with a description of your own street, seen with the hyper-attentive eyes of a first-time visitor. Make the familiar alien, and the alien familiar."
"prompt30": "You have one day completely alone, with no obligations and no possibility of communication. The power and internet are out. How do you spend the hours from waking to sleeping? Detail the rituals, the wanderings, the thoughts, the meals. Do you enjoy the solitude or chafe against it? What arises in the quiet?"
},
{
"prompt31": "Think of a crossroads in your past. Now, imagine you see a ghost of your former self standing there, frozen in that moment of decision. What would you want to say to that ghost? Would you offer comfort, a warning, or just silent companionship? Write the encounter. Does the ghost speak back?"
"prompt31": "Personify a negative emotion you've been feeling lately (e.g., anxiety, envy, restlessness). Give it a name, a form, a voice. Write a character profile of it. What does it want? What does it fear? What flawed logic does it operate under? Then, write a short scene of you having a cup of tea with it, listening to its perspective."
},
{
"prompt32": "What is a tradition in your family or community\u2014big or small\u2014that you find meaningful? Describe its sensory details, its rhythms, its players. Now, trace its origin. How did it start? Has it mutated over time? What does its continued practice say about what your family values, fears, or hopes for?"
"prompt32": "Describe a city you've never been to, based solely on the stories, images, and snippets you've absorbed about it. Build it from imagination and second-hand clues. Then, contrast that with a description of your own street, seen with the hyper-attentive eyes of a first-time visitor. Make the familiar alien, and the alien familiar."
},
{
"prompt33": "Choose a year from your past. Catalog the soundtrack of that year: songs on the radio, albums you loved, jingles, background music. For each, describe a specific memory or feeling it evokes. How does the music of that time period color your memory of the entire era? What does it sound like to you now?"
"prompt33": "Think of a crossroads in your past. Now, imagine you see a ghost of your former self standing there, frozen in that moment of decision. What would you want to say to that ghost? Would you offer comfort, a warning, or just silent companionship? Write the encounter. Does the ghost speak back?"
},
{
"prompt34": "Write instructions for a stranger on how to be you for a day. Include the essential routines, the internal dialogues to expect, the things to avoid, the small comforts to lean on, and the passwords to your various anxieties. Be brutally honest and surprisingly practical. What would they find hardest to mimic?"
"prompt34": "What is a tradition in your family or community\u2014big or small\u2014that you find meaningful? Describe its sensory details, its rhythms, its players. Now, trace its origin. How did it start? Has it mutated over time? What does its continued practice say about what your family values, fears, or hopes for?"
},
{
"prompt35": "Describe a moment of unexpected kindness, either given or received. Don't frame it as a grand gesture. Focus on a small, almost invisible act. What were the circumstances? Why was it so potent? How did it ripple out, changing the temperature of your day or your perception of someone?"
"prompt35": "Choose a year from your past. Catalog the soundtrack of that year: songs on the radio, albums you loved, jingles, background music. For each, describe a specific memory or feeling it evokes. How does the music of that time period color your memory of the entire era? What does it sound like to you now?"
},
{
"prompt36": "You discover you have a superpower, but it is frustratingly mundane and specific (e.g., the ability to always know exactly what time it is without a clock, to perfectly fold fitted sheets, to find lost buttons). Explore the practical uses, the minor heroics, the unexpected downsides, and the peculiar loneliness of this unique gift."
"prompt36": "Write instructions for a stranger on how to be you for a day. Include the essential routines, the internal dialogues to expect, the things to avoid, the small comforts to lean on, and the passwords to your various anxieties. Be brutally honest and surprisingly practical. What would they find hardest to mimic?"
},
{
"prompt37": "Go to a window. Describe the view in extreme detail, as if painting it with words, for five minutes. Then, close your eyes and describe the view from a window that was significant to you in the past (your childhood bedroom, a previous office, a grandparent's house). Juxtapose the two landscapes on the page."
"prompt37": "Describe a moment of unexpected kindness, either given or received. Don't frame it as a grand gesture. Focus on a small, almost invisible act. What were the circumstances? Why was it so potent? How did it ripple out, changing the temperature of your day or your perception of someone?"
},
{
"prompt38": "What is a question you are tired of being asked? Write a rant about why it's so irritating, reductive, or painful. Then, flip it: write the question you wish people would ask you instead. Answer that new question fully and generously."
"prompt38": "You discover you have a superpower, but it is frustratingly mundane and specific (e.g., the ability to always know exactly what time it is without a clock, to perfectly fold fitted sheets, to find lost buttons). Explore the practical uses, the minor heroics, the unexpected downsides, and the peculiar loneliness of this unique gift."
},
{
"prompt39": "Describe a hobby or interest you have from the perspective of someone who finds it utterly baffling and boring. Then, defend it with the passionate zeal of a true devotee. Try to convey its magic and depth to this imagined skeptic. What is the core beauty you see that they miss?"
"prompt39": "Go to a window. Describe the view in extreme detail, as if painting it with words, for five minutes. Then, close your eyes and describe the view from a window that was significant to you in the past (your childhood bedroom, a previous office, a grandparent's house). Juxtapose the two landscapes on the page."
},
{
"prompt40": "List ten things you would do if you were not afraid. They can be grand (quit my job) or small (sing karaoke). Choose one and vividly imagine doing it. Walk through every step, from decision to action to aftermath. How does the air feel different on the other side of that fear?"
"prompt40": "What is a question you are tired of being asked? Write a rant about why it's so irritating, reductive, or painful. Then, flip it: write the question you wish people would ask you instead. Answer that new question fully and generously."
},
{
"prompt41": "Write about a time you got exactly what you wanted\u2014and it was not what you expected. Describe the desire, the anticipation, the moment of attainment, and the subtle (or not-so-subtle) disappointment or confusion that followed. What did that experience teach you about wanting?"
"prompt41": "Describe a hobby or interest you have from the perspective of someone who finds it utterly baffling and boring. Then, defend it with the passionate zeal of a true devotee. Try to convey its magic and depth to this imagined skeptic. What is the core beauty you see that they miss?"
},
{
"prompt42": "Personify your favorite season. Give it a personality, a wardrobe, a way of speaking, a scent. Write a monologue from its perspective. What does it think of humans? What is its purpose? What does it love and resent about its place in the yearly cycle? Let it defend itself against its critics."
"prompt42": "List ten things you would do if you were not afraid. They can be grand (quit my job) or small (sing karaoke). Choose one and vividly imagine doing it. Walk through every step, from decision to action to aftermath. How does the air feel different on the other side of that fear?"
},
{
"prompt43": "Describe a room after a significant emotional event has occurred (a fight, a celebration, a profound conversation), but without mentioning the event or the people. Let the objects, the disarray, the quality of light, the lingering smells tell the story. What is the room holding now?"
"prompt43": "Write about a time you got exactly what you wanted\u2014and it was not what you expected. Describe the desire, the anticipation, the moment of attainment, and the subtle (or not-so-subtle) disappointment or confusion that followed. What did that experience teach you about wanting?"
},
{
"prompt44": "What is a rule you live by? It can be profound ('assume good intent') or practical ('never grocery shop hungry'). Explain its origin story. When have you broken it, and what were the consequences? How has following it shaped your life? Argue for its universal adoption."
"prompt44": "Personify your favorite season. Give it a personality, a wardrobe, a way of speaking, a scent. Write a monologue from its perspective. What does it think of humans? What is its purpose? What does it love and resent about its place in the yearly cycle? Let it defend itself against its critics."
},
{
"prompt45": "Imagine you can send a message of exactly 100 words into the future, to be read by you in ten years. What do you say? What do you ask? What current worry do you want to soothe, or what current joy do you want future-you to remember? Write the message. Then, write a 100-word message from you-ten-years-ago to present-you."
"prompt45": "Describe a room after a significant emotional event has occurred (a fight, a celebration, a profound conversation), but without mentioning the event or the people. Let the objects, the disarray, the quality of light, the lingering smells tell the story. What is the room holding now?"
},
{
"prompt46": "Describe a color to someone who has been blind from birth. Use metaphor, texture, temperature, sound, emotion, and memory. Don't rely on sight-based comparisons ('like the sky'). Try to make them *feel* the essence of 'red' or 'blue' or 'gold' in their bones."
"prompt46": "What is a rule you live by? It can be profound ('assume good intent') or practical ('never grocery shop hungry'). Explain its origin story. When have you broken it, and what were the consequences? How has following it shaped your life? Argue for its universal adoption."
},
{
"prompt47": "Write about a book that changed your mind. Not just one you loved, but one that actively altered your perspective on a topic. Describe your stance before, the unsettling process of reading it, and the new landscape of thought afterwards. What made you vulnerable to its argument?"
"prompt47": "Imagine you can send a message of exactly 100 words into the future, to be read by you in ten years. What do you say? What do you ask? What current worry do you want to soothe, or what current joy do you want future-you to remember? Write the message. Then, write a 100-word message from you-ten-years-ago to present-you."
},
{
"prompt48": "Catalog the contents of a junk drawer or a cluttered bag\u2014yours or an imagined one. Describe each item with care, as an archaeologist might. Then, construct a biography of the drawer's owner based solely on these artifacts. What story do these mundane relics tell?"
"prompt48": "Describe a color to someone who has been blind from birth. Use metaphor, texture, temperature, sound, emotion, and memory. Don't rely on sight-based comparisons ('like the sky'). Try to make them *feel* the essence of 'red' or 'blue' or 'gold' in their bones."
},
{
"prompt49": "What does your body know how to do that your mind often forgets? (e.g., breathe deeply, relax into sleep, find rhythm in a walk). Write a series of instructions from your body to your mind, teaching it this skill again. Use the language of sensation, not thought."
"prompt49": "Write about a book that changed your mind. Not just one you loved, but one that actively altered your perspective on a topic. Describe your stance before, the unsettling process of reading it, and the new landscape of thought afterwards. What made you vulnerable to its argument?"
},
{
"prompt50": "Describe a journey you take every day (commute, walk the dog, trip to the kitchen) as a epic quest. Cast yourself as the hero, the mundane obstacles as trials (the traffic dragon, the staircase mountain), and the destination as a holy grail. Infuse the ordinary with mythic significance."
"prompt50": "Catalog the contents of a junk drawer or a cluttered bag\u2014yours or an imagined one. Describe each item with care, as an archaeologist might. Then, construct a biography of the drawer's owner based solely on these artifacts. What story do these mundane relics tell?"
},
{
"prompt51": "Write a review of today, as if it were a product, a performance, or a restaurant. Give it star ratings in different categories (Productivity, Serendipity, Comfort, Learning). Write the critic's summary. Be witty, be harsh, be fair. What was the highlight? The biggest flaw? Would you recommend today to a friend?"
"prompt51": "What does your body know how to do that your mind often forgets? (e.g., breathe deeply, relax into sleep, find rhythm in a walk). Write a series of instructions from your body to your mind, teaching it this skill again. Use the language of sensation, not thought."
},
{
"prompt52": "Think of a word you love the sound of. Write it at the top of the page. Now, free-associate from that word\u2014not just meanings, but sounds, memories, images. Let it spin a web of connections. Where does it lead you? Try to capture the aesthetic and emotional resonance of the word itself."
"prompt52": "Describe a journey you take every day (commute, walk the dog, trip to the kitchen) as a epic quest. Cast yourself as the hero, the mundane obstacles as trials (the traffic dragon, the staircase mountain), and the destination as a holy grail. Infuse the ordinary with mythic significance."
},
{
"prompt53": "Describe a piece of technology you use daily from the perspective of a person from 200 years ago. Have them stumble upon it and try to deduce its purpose, its magic, and its societal implications from its form and behavior. What would they find beautiful, terrifying, or absurd?"
"prompt53": "Write a review of today, as if it were a product, a performance, or a restaurant. Give it star ratings in different categories (Productivity, Serendipity, Comfort, Learning). Write the critic's summary. Be witty, be harsh, be fair. What was the highlight? The biggest flaw? Would you recommend today to a friend?"
},
{
"prompt54": "Write a gratitude list, but for difficult things. Be specific. Not just 'my job,' but 'the particular frustration of my project that forced me to learn a new skill.' Find the hidden gift in the challenge, the strength forged in the irritation, the clarity born of the sorrow."
"prompt54": "Think of a word you love the sound of. Write it at the top of the page. Now, free-associate from that word\u2014not just meanings, but sounds, memories, images. Let it spin a web of connections. Where does it lead you? Try to capture the aesthetic and emotional resonance of the word itself."
},
{
"prompt55": "You meet a version of yourself from a parallel universe where one key life detail is different (you chose a different career, never moved, stayed with a different partner). Have a conversation with them. What do you envy? What do you pity? What fundamental part of 'you' remains the same?"
"prompt55": "Describe a piece of technology you use daily from the perspective of a person from 200 years ago. Have them stumble upon it and try to deduce its purpose, its magic, and its societal implications from its form and behavior. What would they find beautiful, terrifying, or absurd?"
},
{
"prompt56": "Describe a taste from your childhood that you can almost, but not quite, recall\u2014a specific candy, a grandparent's dish, a seasonal treat. Try to chase the memory with all your senses. What else was happening when you tasted it? Who was there? Why is it lost? The struggle to remember is the story."
"prompt56": "Write a gratitude list, but for difficult things. Be specific. Not just 'my job,' but 'the particular frustration of my project that forced me to learn a new skill.' Find the hidden gift in the challenge, the strength forged in the irritation, the clarity born of the sorrow."
},
{
"prompt57": "What is a place that feels like a sanctuary to you? Describe it not just physically, but atmospherically. What rules (spoken or unspoken) govern it? What happens to your internal noise when you enter? What would it mean to carry the essence of that place with you into busier, louder realms?"
"prompt57": "You meet a version of yourself from a parallel universe where one key life detail is different (you chose a different career, never moved, stayed with a different partner). Have a conversation with them. What do you envy? What do you pity? What fundamental part of 'you' remains the same?"
},
{
"prompt58": "Write about waiting. Describe a specific time you were waiting for something (big or small). Capture the texture of the time itself\u2014how it stretched, what you noticed, the cycles of hope and boredom. What did you learn in the suspension? The action is in the inaction."
"prompt58": "Describe a taste from your childhood that you can almost, but not quite, recall\u2014a specific candy, a grandparent's dish, a seasonal treat. Try to chase the memory with all your senses. What else was happening when you tasted it? Who was there? Why is it lost? The struggle to remember is the story."
},
{
"prompt59": "Compose a manifesto for a very small, personal revolution. What outdated pattern, fear, or limitation are you overthrowing? What are your guiding principles? What is your first, tiny act of rebellion? Use bold, declarative language. Declare your independence from something that no longer serves you."
"prompt59": "What is a place that feels like a sanctuary to you? Describe it not just physically, but atmospherically. What rules (spoken or unspoken) govern it? What happens to your internal noise when you enter? What would it mean to carry the essence of that place with you into busier, louder realms?"
}
]

View File

@@ -1 +1 @@
[]

82
test_end_to_end.py Normal file
View File

@@ -0,0 +1,82 @@
#!/usr/bin/env python3
"""
End-to-end test to verify prompts are stored as simple strings without keys.
"""
import json
import sys
import os
# Add the current directory to the Python path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from generate_prompts import JournalPromptGenerator
def test_end_to_end():
"""Test the complete flow from parsing to pool management."""
print("Testing end-to-end flow...")
print("="*60)
# Create a generator instance
generator = JournalPromptGenerator(config_path=".env")
# Clear the pool first
generator.pool_prompts = []
generator._save_pool_prompts()
# Test 1: Simulate AI response (JSON list format)
print("\n1. Simulating AI response (JSON list format)...")
mock_ai_response = json.dumps([
"Write about a childhood memory that still makes you smile.",
"Describe your perfect day from start to finish.",
"What is something you've been putting off and why?",
"Imagine you could have a conversation with any historical figure."
])
# Parse the response
parsed_prompts = generator._parse_ai_response(mock_ai_response)
print(f" Parsed {len(parsed_prompts)} prompts")
print(f" All prompts are strings: {all(isinstance(p, str) for p in parsed_prompts)}")
print(f" No prompts have keys: {all(not isinstance(p, dict) for p in parsed_prompts)}")
# Test 2: Add to pool
print("\n2. Adding prompts to pool...")
generator.add_prompts_to_pool(parsed_prompts)
print(f" Pool now has {len(generator.pool_prompts)} prompts")
print(f" All pool prompts are strings: {all(isinstance(p, str) for p in generator.pool_prompts)}")
# Test 3: Draw from pool
print("\n3. Drawing prompts from pool...")
drawn_prompts = generator.draw_prompts_from_pool(count=2)
print(f" Drew {len(drawn_prompts)} prompts")
print(f" Drawn prompts are strings: {all(isinstance(p, str) for p in drawn_prompts)}")
print(f" Pool now has {len(generator.pool_prompts)} prompts remaining")
# Test 4: Save and load pool
print("\n4. Testing pool persistence...")
# Save current pool
generator._save_pool_prompts()
# Create a new generator instance to load the pool
generator2 = JournalPromptGenerator(config_path=".env")
print(f" New instance loaded {len(generator2.pool_prompts)} prompts from pool_prompts.json")
print(f" Loaded prompts are strings: {all(isinstance(p, str) for p in generator2.pool_prompts)}")
# Test 5: Check pool_prompts.json content
print("\n5. Checking pool_prompts.json file content...")
with open("pool_prompts.json", "r") as f:
pool_content = json.load(f)
print(f" File contains {len(pool_content)} items")
print(f" First item type: {type(pool_content[0])}")
print(f" First item is string: {isinstance(pool_content[0], str)}")
print(f" First item value: {pool_content[0][:50]}...")
print("\n" + "="*60)
print("✅ All tests passed! Prompts are stored as simple strings without keys.")
print("="*60)
return True
if __name__ == "__main__":
test_end_to_end()