Skip to content

How Claude Learns and Retains Information


License: Apache License 2.0 Copyright: © 2025 Smart AI Memory, LLC Project: AI Nurse Florence Repository: https://github.com/silversurfer562/ai-nurse-florence


A comprehensive guide to understanding AI learning mechanics for developers


Introduction

Understanding how AI assistants like Claude learn and retain information is crucial for effective collaboration. This guide explains the mechanics of AI learning, context management, and how to structure information for optimal AI assistance in software development projects.


1. Project Knowledge: How AI Accesses Your Documents

What Happens When You Save Files to a Project

When you save documents (CSV, JSON, markdown, Python files, etc.) to an AI project, they become part of the AI's working context. Here's how it works:

Similarities to Traditional Chatbot Training

CSV Training Approach (Traditional): - ✅ Structured Reference: Fixed Q&A pairs the bot memorizes - ✅ Contextual Access: Bot retrieves matching answers - ❌ Pattern Matching Only: No true understanding

Modern AI Project Access: - ✅ Dynamic Reference: AI reads files in real-time during conversations - ✅ Semantic Understanding: AI comprehends context and relationships - ✅ Cross-File Intelligence: AI connects information across multiple sources - ❌ NOT Permanent Training: AI doesn't internalize data into its base model

Key Differences

  1. Dynamic Access: AI reads files in real-time during conversations, not as pre-training
  2. Flexible Formats: AI can work with any text-based format (not just CSV)
  3. Semantic Understanding: AI understands context and relationships, not just pattern matching
  4. File Relationships: AI can connect information across multiple files

Visual Comparison

Traditional CSV Training:           Modern AI Project Access:
┌──────────────────────┐           ┌──────────────────────────┐
│ Q: What is SBAR?     │           │ Read: docs/SBAR_GUIDE.md │
│ A: Situation, Back...│           │ Understand context       │
│ (Memorized pattern)  │           │ Cross-reference code     │
└──────────────────────┘           │ Apply to current task    │
                                   └──────────────────────────┘

2. Memory & Context: Three Types of AI Knowledge

Modern AI assistants work with three distinct layers of knowledge:

Layer 1: Base Training Knowledge

  • What it is: General knowledge, programming concepts, domain expertise
  • Persistence: Permanent, always available
  • Example: Python syntax, medical terminology, software patterns
  • Limitation: No knowledge of your specific codebase or preferences
  • Training Cutoff: Fixed date (e.g., October 2023 for Claude)

Layer 2: Project Document Knowledge

  • What it is: Information in files saved to the project
  • Persistence: Available as long as files exist in project
  • Access Method: AI reads files during conversation using file access tools
  • Example: Your architecture docs, code files, database schemas
  • Key Point: AI re-reads these each session - they're references, not memories

Layer 3: Conversation Knowledge

  • What it is: Information shared during the current conversation
  • Persistence: Current session only (with summaries for continuity)
  • Example: "I prefer blue color scheme", "Focus on Epic integration today"
  • Limitation: Resets between major context boundaries

Visual Representation

┌─────────────────────────────────────────────────┐
│ Layer 1: Base Knowledge (Permanent)             │
│ • Python, Frameworks, General Domain Knowledge  │
└─────────────────────────────────────────────────┘
           ▼ Specialized by
┌─────────────────────────────────────────────────┐
│ Layer 2: Project Files (Persistent References)  │
│ • Your code, docs, schemas, standards           │
│ • AI READS these when needed                    │
└─────────────────────────────────────────────────┘
           ▼ Contextualized by
┌─────────────────────────────────────────────────┐
│ Layer 3: Conversation (Session-Scoped)          │
│ • Your current preferences, recent decisions    │
│ • Goals for this specific task                  │
└─────────────────────────────────────────────────┘

3. Persistence: What AI Remembers Across Sessions

What Persists Between Sessions

Project Files: All documents you save remain available ✅ Conversation Summaries: Continuations get summaries of previous work ✅ Codebase State: Files that were read/edited are still there ✅ Encoded Preferences: Patterns visible in code and documentation

What Doesn't Persist

Ephemeral Preferences: "Use blue for this feature" (unless documented) ❌ Temporary Context: "We're focusing on Epic integration today" ❌ In-conversation Learning: Insights not saved to files ❌ Undocumented Decisions: Choices made but not written down

Example Scenario: How Preferences Persist

Session 1:
Developer: "I prefer blue colors (blue-600) for our branding"
AI: *Uses blue throughout Epic integration*
AI: *Updates CSS files with blue-600 values*
*Session ends*

Session 2 (weeks later):
Developer: "Add a new feature to the dashboard"
AI: *Reads static/index.html, sees blue-600 colors*
AI: *Applies same blue color scheme*

Why it works: The preference was ENCODED in files (CSS classes,
color values), not just mentioned in conversation.

4. How to Optimize Information Structure for AI

Best Practices for Long-term Knowledge

DO:

✅ Create docs/DEVELOPMENT_PHILOSOPHY.md
✅ Document coding standards in accessible files
✅ Save example patterns with explanatory comments
✅ Use consistent, meaningful file/folder naming
✅ Link related documents (cross-reference)
✅ Update documentation when patterns change

DON'T:

❌ Rely on telling AI preferences each session
❌ Assume AI remembers context from weeks ago
❌ Leave important decisions undocumented
❌ Use vague file names (utils.py, misc.py)

For Reusable Patterns

Good Example - Documented in Code:

class ServiceBase:
    """
    Base pattern for all services in AI Nurse Florence.

    Conventions from Shirley Thomas's mentorship:
    - Always use dependency injection
    - Log at INFO level for business logic
    - Return Pydantic models, not dicts
    - Handle errors with custom exceptions

    See docs/CODING_STANDARDS.md for details.
    """

def __init__(self, logger: logging.Logger):
    self.logger = logger

**Bad Example - Only Mentioned Once:**python

AI was told "I like to use this pattern" in conversation

but it's not documented anywhere

class Service: pass # AI won't remember the pattern next session ```

For Project-Specific Knowledge

Recommended File Structure:

docs/
├── ARCHITECTURE.md        # System design and patterns
├── CODING_STANDARDS.md    # Your preferences and rules
├── WORKFLOWS.md           # Step-by-step processes
├── PATTERNS.md            # Reusable code templates
├── MENTORSHIP_NOTES.md    # Lessons from mentors
└── book/                  # Book chapters and research
    ├── HOW_CLAUDE_LEARNS.md
    └── AI_LEARNING_PROMPTS.md

Reference in Code:

# Per CODING_STANDARDS.md: Always use async/await for I/O operations
async def fetch_patient_data(mrn: str):
    ...

# Follows PATTERNS.md: Service Layer Pattern
class PatientService:
    ...

Meaningful Naming:

✅ Good: epic_fhir_client.py    (purpose is clear)
❌ Bad:  utils.py               (AI must guess purpose)

✅ Good: patient_lookup_service.py
❌ Bad:  service.py


5. The Critical Insight: Pattern Matching vs. Understanding

Traditional CSV Training = Pattern Matching

Characteristics: - Fixed Q&A pairs - Exact matches only - No understanding of context - Cannot generalize to new situations - Brittle when questions vary slightly

Example:

Question,Answer
"How do I create a router?","1. Create file in src/routers/ 2. Define router = APIRouter() 3. Add routes..."
If you ask "How do I add a new endpoint?" it won't match.

Modern AI = Contextual Understanding

Characteristics: - Reads and comprehends documentation - Understands relationships between files - Can apply principles to new situations - Combines information from multiple sources - Adapts to variations in requests

Example Process:

Developer: "Create a new router for lab results"

AI Process:
1. Read existing routers (src/routers/*.py)
2. Understand the common pattern
3. See how they're registered in app.py
4. Read CODING_STANDARDS.md for preferences
5. Check PATTERNS.md for router template
6. Apply all of this to create new router YOUR way


6. Practical Recommendations

Immediate Actions for Your Project

  1. Create Core Documentation:

    docs/
    ├── DEVELOPMENT_PHILOSOPHY.md  # Your approach & mentor's teachings
    ├── CODING_STANDARDS.md        # Concrete rules AI can follow
    └── PATTERNS.md                # Reusable templates with explanations
    

  2. Add Inline Documentation:

    # Reference standards in code
    # Per CODING_STANDARDS.md: Use dependency injection
    def __init__(self, db: Database = Depends(get_db)):
        ...
    

  3. Establish Naming Conventions:

  4. Document in CODING_STANDARDS.md
  5. Apply consistently across codebase
  6. AI will learn and replicate the pattern

  7. Cross-Reference Documents:

    # In ARCHITECTURE.md
    See PATTERNS.md for implementation templates.
    See CODING_STANDARDS.md for style guidelines.
    

For Building Intelligent Applications

The same principles apply when building AI-powered applications like AI Nurse Florence:

An intelligent app needs:

  1. Knowledge Base (like AI's project files)
  2. Structured information it can reference
  3. Medical protocols, drug databases, clinical guidelines
  4. Stored in accessible formats (JSON, DB, vector embeddings)

  5. Processing Logic (like AI's base training)

  6. How to interpret and apply knowledge
  7. Rules engines, ML models, decision trees
  8. Context-aware reasoning

  9. Context Management (like conversation state)

  10. Understanding current patient state
  11. Tracking conversation history
  12. Maintaining session data

  13. Learning Mechanism

  14. How to improve based on new information
  15. Feedback loops from user interactions
  16. Pattern recognition over time

7. Key Takeaways for Developers

Understanding AI Limitations

  1. AI doesn't "remember" in the human sense
  2. It references documentation
  3. It reads context
  4. It applies patterns
  5. But it doesn't have persistent memory between sessions

  6. Encode knowledge in files, not conversations

  7. Conversations are temporary
  8. Files are permanent references
  9. Well-documented code teaches AI your patterns

  10. Structure enables intelligence

  11. Consistent patterns → AI learns them
  12. Clear documentation → AI applies it correctly
  13. Cross-referenced files → AI connects concepts

Building Effective AI Collaboration

The Formula:

Effective AI Assistance =
    (Clear Documentation)
    + (Consistent Patterns)
    + (Accessible References)
    + (Specific Context in Conversation)

Example:

# ❌ Temporary (AI forgets next session)
"Make buttons blue like we discussed"

# ✅ Permanent (AI references every time)
<!-- Per DESIGN_SYSTEM.md: Primary buttons use blue-600 -->
<button class="bg-blue-600 hover:bg-blue-700">


8. Application to AI Nurse Florence

How These Principles Apply

When building an intelligent nursing application:

Knowledge Organization:

Clinical Knowledge (Permanent)
Patient Data (Session/Contextual)
Current Interaction (Temporary)

Implementation:

# Knowledge Base (like AI's project files)
clinical_protocols = load_json("data/protocols/*.json")

# Context (like conversation state)
patient_context = {
    "current_conditions": [...],
    "active_medications": [...],
    "session_goals": [...]
}

# Processing (like AI reasoning)
recommendation = intelligent_decision_engine(
    knowledge=clinical_protocols,
    context=patient_context,
    base_reasoning=clinical_ai_model
)

The Parallel

AI Assistant AI Nurse Florence
Reads project docs Reads clinical protocols
Understands code patterns Understands care patterns
References standards References evidence-based guidelines
Maintains conversation context Maintains patient context
Applies general knowledge + specific context Applies clinical knowledge + patient specifics

Conclusion

Understanding how AI learns and retains information transforms how you collaborate with AI assistants and how you architect intelligent applications. The key principles:

  1. Documentation is permanent, conversations are temporary
  2. Structure enables intelligence
  3. Context + Knowledge + Reasoning = Intelligent behavior
  4. The same patterns apply to building intelligent apps

Whether you're working with Claude on your codebase or building AI Nurse Florence for clinical decision support, these principles create the foundation for effective AI collaboration and intelligent system design.


Further Reading

  • AI_LEARNING_PROMPTS.md - Structured prompts for AI knowledge transfer
  • DEVELOPMENT_PHILOSOPHY.md - Your coding standards and preferences (to be created)
  • PATTERNS.md - Reusable code templates (to be created)

Written: January 7, 2025 Author: Patrick Roebuck (with Claude) Purpose: Book chapter on AI collaboration and intelligent system design Status: Complete - Ready for book inclusion