Overview
Context management is a consistent lingering issue when working with LLMs and Agents. We’ve tackled context management by giving Ana a GitHub access token paired with organizational prompts. This allows Ana to reference your shared repository, learn your team’s preferences and patterns, and generate SQL queries and visualizations that naturally align with your established practices, significantly improving consistency and relevance. Quick Summary: Give Ana access to a GitHub repository where she can store and retrieve context, preferences, and learned patterns across sessions.How It Works
By providing Ana with a GitHub personal access token, she can:- Create and update files in a designated repository
- Store conversation context, analysis results, and insights
- Retrieve previously stored information in future sessions
- Build a persistent knowledge base that grows over time
Important: Review All Pull Requests ManuallyEnabling persistent memory allows Ana to automatically create branches and pull requests with context changes. This automation may lead to unintended or unforeseen modifications to your context repository, which could affect Ana’s behavior in future sessions.Always manually review and approve all pull requests before merging to ensure:
- Changes align with your intended context and preferences
- No sensitive or incorrect information is being stored
- The modifications will produce the desired behavior in future interactions
Setup Instructions
1. Create a Memory Repository
- Create a new repository on GitHub (can be private or public)
- Name it something like
ana-memory
ortextql-context
- Initialize it with a README if desired

2. Create a GitHub Personal Access Token
- Go to GitHub Settings → Developer settings → Personal access tokens
- Click “Generate new token”
- Give your token a descriptive name (e.g., “Ana Memory Storage”)

-
Select the following scopes:
Only select repositories
(Limiting Ana’s scope - Make sure you select the repo you created before, i.e.,ana-memory
ortextql-context
)
-
Expiration. Select an appropriate expiration date. For our purposes, we chose
30 days
. -
Provisioning Scope. You need to give Ana access to
Content:Read:Write
- she needs to be able to pull context and write new context to the repo.

-
Click
Generate token
. - Important: Copy the token - you won’t be able to see it again.
3. Configure Secrets and System Prompt
Now you’ll add the GitHub token to TextQL and configure Ana’s system prompt. Step 3a: Add GitHub Token to Secrets Navigate to your secrets configuration > Configuration > Secrets Enabled > Manage Secrets and add the GitHub access token as a secret namedANA_CONTEXT_ACCESS_TOKEN
:


- Always read the repository first to understand context
- Detect when users like specific outputs (SQL queries, Python cells, visualizations)
- Automatically save preferred work to the GitHub repository
- Organize saved content in a structured directory format
Click to expand example system prompt template for persistent memory
Click to expand example system prompt template for persistent memory

Demo: Persistent Memory in Action
Here’s an example of how persistent memory works in practice:Use Case
Ana receives a request and references the context repository to understand previous work and team preferences:
Result
Ana successfully retrieves and applies stored context, providing responses aligned with previous work and established patterns:
Usage
Once configured, Ana can:- Save insights: “Ana, please save this analysis to your memory”
- Retrieve context: “Ana, check your memory for previous work on this topic”
- Build knowledge: Ana will automatically reference stored context when relevant
Best Practices
- Use a dedicated repository for Ana’s memory to keep it organized
- Consider using a private repository if storing sensitive information
- Regularly review the stored content to ensure it remains relevant
- Keep context up to date by deleting outdated or unused context to maintain relevance.
- Rotate tokens periodically for security best practices.
Troubleshooting
Token not working:- Verify the token has
repo
scope permissions. - Ensure the repository exists and the token has access to it.
- Check that the token hasn’t expired.
- Confirm the repository name and owner are correct.
- Verify the token has write permissions.
- Ensure the repository isn’t archived or read-only.