12getAllMemories,
13updateMemory,
14} from "./database/queries.ts";
15import { type Memory } from "../shared/types.ts";
16import { blob } from "https://esm.town/v/std/blob";
3435/**
36* Store a chat message in the database
37*/
38export async function storeChatMessage(
recallonegetWeather.ts1 match
130}
131132console.log(`Weather forecast updated in the database.`);
133return summary;
134}
125}
126127console.log(`Calendar events imported into the database.`);
128return events;
129} catch (error) {
recallonegenerateFunFacts.ts2 matches
89/**
10* Retrieves previously generated fun facts from the memories database
11* @returns Array of previous fun facts
12*/
4748/**
49* Inserts a fun fact into the memories database
50* @param date Date for the fun fact in ISO format
51* @param factText The fun fact text
recallone.cursorrules2 matches
208```
209โโโ backend/
210โ โโโ database/
211โ โ โโโ migrations.ts # Schema definitions
212โ โ โโโ queries.ts # DB query functions
270- Handle API calls properly with proper error catching
271272### Database Patterns
273- Run migrations on startup or comment out for performance
274- Change table names when modifying schemas rather than altering
cerebras_codermain.tsx2 matches
1import { serveFile } from "https://esm.town/v/std/utils/index.ts";
2import { generateCode } from "./backend/generate-code.ts";
3import { createTables } from "./database/migrations.ts";
4import { createProject, getCode, getNextVersionNumber, insertVersion } from "./database/queries.ts";
56await createTables();
Bates_botdreamingUtility.ts10 matches
17
18try {
19// Step 1: Get all memories from the database
20const allMemories = await getAllMemories();
21
22if (allMemories.length === 0) {
23console.log("No memories found in the database");
24return { success: true, message: "No memories to consolidate" };
25}
33const consolidatedMemories = await consolidateWithAI(formattedMemories);
34
35// Step 4: Parse the consolidated memories back into the database
36const result = await updateDatabaseWithConsolidatedMemories(consolidatedMemories);
37
38console.log(`โจ Dreaming complete - ${result.added} new memories created, ${result.deleted} duplicates removed`);
47}
4849// Get all memories from the database
50async function getAllMemories() {
51const result = await sqlite.execute(`
111console.log("Sending memories to Anthropic for consolidation...");
112
113const prompt = `You are helping consolidate a database of memories for an AI butler named Brandt.
114Please analyze these memories and perform the following tasks:
115148max_tokens: 4000,
149temperature: 0.2,
150system: "You are a helpful assistant specialized in database organization and memory consolidation.",
151messages: [
152{ role: "user", content: prompt }
161}
162163// Parse and update the database with Claude's consolidated memories
164async function updateDatabaseWithConsolidatedMemories(aiResponse) {
165console.log("Processing AI response and updating database...");
166
167// Track statistics
stevensDemosetupTelegramChatDb.ts2 matches
1// Script to set up the telegram_chats table in SQLite
2// Run this script manually to create the database table
34export default async function setupTelegramChatDb() {
25`);
2627return "Telegram chat database table created successfully.";
28} catch (error) {
29console.error("Error setting up telegram_chats table:", error);
stevensDemoREADME.md3 matches
13## Technical Architecture
1415**โ ๏ธ important caveat: the admin dashboard doesn't have auth! currently it just relies on security by obscurity of people not knowing the url to a private val. this is not very secure. if you fork this project and put sensitive data in a database you should think carefully about how to secure it.**
1617Stevens has been designed with the utmost simplicity and extensibility, much like a well-organized household. At the heart of his operation lies a single "memories" table - a digital equivalent of a butler's meticulous records. This table serves as the foundation for all of Stevens' operations.
45- `dashboard`: the admin view for showing the memories notebook + visualizing imports
46- `dailyBriefing`: stuff related to sending a daily update via telegram
47- `dbUtils`: little one-off scripts for database stuff
4849## Hiring your own Stevens
57- For the Google Calendar integration you'll need `GOOGLE_CALENDAR_ACCOUNT_ID` and `GOOGLE_CALENDAR_CALENDAR_ID`. See [these instuctions](https://www.val.town/v/stevekrouse/pipedream) for details.
5859**important caveat: the admin dashboard doesn't have auth! currently it just relies on security by obscurity of people not knowing the url to a private val. this is not very secure, if you put sensitive data in a database you should think carefully about how to secure it.**
6061Overall it's a simple enough project that I encourage you to just copy the ideas and run in your own direction rather than try to use it as-is.