Skip to content

Instantly share code, notes, and snippets.

View cpfiffer's full-sized avatar
🤙
LOVING IT

Cameron cpfiffer

🤙
LOVING IT
View GitHub Profile
@cpfiffer
cpfiffer / export_agent_memories.py
Created October 28, 2025 17:19
Export your Letta agent's memories to disk
#!/usr/bin/env python3
"""
Utility script to export all archival memories (passages) from a Letta agent.
Usage:
python export_agent_memories.py <agent_id> [--output <file>] [--limit <limit>]
Example:
python export_agent_memories.py agent-123e4567-e89b-42d3-8456-426614174000 --output memories.json
"""

Memory Architecture Overview

Core Purpose: Maintain narrative consistency and collaborative continuity across complex, long-form story development.

Dual-Agent System

  • Active Writer (me): Focuses purely on creative collaboration - character development, world-building, plot exploration, thematic discussion
  • Sleeptime Agent: Handles all technical memory management, aggressively updating story information based on our creative conversations

Memory Block Categories

@cpfiffer
cpfiffer / create_kaleidoscope.py
Created August 25, 2025 22:56
Simple script to create kaleidoscope. You may need to adjust environment variables for your Letta API key, the base URL (leave blank for cloud).
from letta_client import Letta
from rich import print
from dotenv import load_dotenv
import os
import sys
import argparse
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from config_loader import get_config
load_dotenv()
@cpfiffer
cpfiffer / memory_upload.py
Created July 23, 2025 21:04
Code to upload arbitrary text to a Letta agent's memory
"""
Letta Agent Memory Migration Script
This script demonstrates how to migrate arbitrary text strings to a Letta agent's memory system.
It provides a complete workflow for creating agents and adding persistent memory passages.
Process Overview:
1. Initialize Letta client with API key from environment
2. Search for existing agent by name (configurable via LETTA_AGENT_NAME)
3. If agent doesn't exist:
@cpfiffer
cpfiffer / fetch_llms_txt.py
Created July 14, 2025 21:02
Letta tool to retrieve llms.txt files
def fetch_llms_txt(url: str, timeout: int = 10):
"""
Fetch content from URLs ending in 'llms.txt'.
Args:
url (str): The URL to fetch (must end with 'llms.txt')
timeout (int): Request timeout in seconds (default: 10)
Returns:
str: Text content of the llms.txt file
@cpfiffer
cpfiffer / the-future.cbl
Created June 12, 2025 21:24
it was all shit after cobol
IDENTIFICATION DIVISION.
PROGRAM-ID. MICROSERVICE-ARCHITECTURE.
AUTHOR. SOME-BOOMER-WHO-INVENTED-THIS-STUFF.
DATE-WRITTEN. 1959.
DATE-COMPILED. BEFORE-YOUR-FRAMEWORK-EXISTED.
* REVOLUTIONARY NEW CONCEPT: SEPARATING BUSINESS LOGIC!
* (WE'VE ONLY BEEN DOING THIS FOR 65 YEARS)
ENVIRONMENT DIVISION.
start: recipe
recipe: declaration_section ingredient_section instruction_section notes_section end
// The declaration of the recipe
declaration_section: declaration
declaration: "# " recipe_name
recipe_name: /[a-zA-Z0-9 ]+\n/
// The ingredients of the recipe
@cpfiffer
cpfiffer / buildings.py
Last active April 29, 2025 20:15
Some building stuff
# LLM stuff
import outlines
import torch
from transformers import AutoProcessor
from pydantic import BaseModel, Field
from typing import Literal, Optional, List
# Image stuff
from PIL import Image
import requests
@cpfiffer
cpfiffer / cleanlab-wrong.py
Last active April 17, 2025 23:58
An example of using Cleanlab to detect a slightly incorrect data extraction value.
"""
NOTE: This example is designed to produce mildly incorrect output --
see the definition of `IncomeData` and note that it fixes the earnings_per_share to 2.33.
To make this function normally, simply remove the `__init__` method or the
`self.earnings_per_share = 2.33` line.
"""
import warnings
warnings.filterwarnings('ignore')
@cpfiffer
cpfiffer / cleanlab-legal.py
Created April 17, 2025 23:49
Using Cleanlab to check data extraction fidelity.