Understanding how AIWB manages context is key to working efficiently with the AI. This guide explains the two types of context and how to use them effectively.
- What is Context?
- Two Types of Context
- How Context Works
- Common Workflows
- Commands Reference
- Best Practices
- Troubleshooting
Context refers to the files and information that AIWB sends to the AI along with your messages. When you ask the AI a question about your code, it needs to see your code files - that's context.
Think of context as the documents you'd spread out on your desk when working on a project.
What it is:
- Files actively loaded in your current AIWB session
- Stored in the
MODE_UPLOADS[]array in RAM - These files are included in every AI conversation during this session
Lifespan:
- β Exists: While AIWB is running
- β Lost: When you close AIWB
Use when:
- Working on files during this session only
- Trying out different contexts
- Need immediate, temporary access to files
View with:
/context β List current context (in-memory)
What it is:
- Context saved to disk (
~/.aiwb/workspace/.context_state) - Survives after closing AIWB
- Can be restored in future sessions
Lifespan:
- β Exists: Permanently (until you clear it)
- β Survives: Closing and reopening AIWB
Use when:
- Working on a project across multiple sessions
- Want to resume where you left off
- Have a standard set of files you always need
View with:
/context β Show persistent context (saved state)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 1. START AIWB β
βββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββ
β
β
βββββββββββββββββββββββββββββββββ
β Found context from previous β
β session (2 days ago) β
β β
β Resume with previous context? β
β [Yes] [No] β
βββββββββββββ¬ββββββββββββββββββββ
β
βββββββββ΄βββββββββ
β β
Yes β β No
β β
βββββββββββββββββββ ββββββββββββββββ
β Select files β β Start with β
β to load β β empty memory β
β β file1.js β ββββββββββββββββ
β β file2.js β
β file3.js β
ββββββββββ¬βββββββββ
β
β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β IN-MEMORY CONTEXT (Active) β
β β’ file1.js β
β β’ file2.js β
β β
β These files are included in all AI prompts this session β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
β During session, you can:
β β’ Add more files
β β’ Remove files
β β’ View what's loaded
β
β
ββββββββββββββββββββββ
β /context menu β
β β’ Add files β
β β’ Remove files β
β β’ Save to disk β
ββββββββββββββββββββββ
β
β Optional: Save to disk
β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β PERSISTENT CONTEXT (Saved to disk) β
β ~/.aiwb/workspace/.context_state β
β β
β Saved for next session β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Day 1 - Starting a new project:
- You start AIWB:
aiwb chat - No previous context exists
- You add files:
/contextβ "Add files/directories" - Select:
src/app.js,README.md - Files are now in memory - included in AI conversations
- (Optional) Save for tomorrow:
/contextβ "Save in-memory context to persistent state" - Close AIWB
Day 2 - Continuing work:
- Start AIWB:
aiwb chat - Prompt appears: "Found context from previous session (1 day ago)"
- You choose: Yes
- File selection appears:
β Select All π src/app.js π README.md - You select both files
- Files load into memory - ready to use
- Continue working with context active
# Start AIWB
aiwb chat
# Add files for this session only
/context β Add files/directories β Select files
# Ask questions
> How does the authentication work in app.js?
# When done, just exit
# No need to save - it was temporary contextResult: Files were used this session but not saved for later.
# Day 1: Set up project context
aiwb chat
/context β Add files/directories
# Select your main project files
# Save for future sessions
/context β Save in-memory context to persistent state
# Day 2: Resume where you left off
aiwb chat
# [Yes] to "Resume with previous context?"
# Select files you want active today
# Continue working...Result: Your project context is saved and reusable across sessions.
# You have 10 files saved in persistent context
# But today you only need 2 of them
aiwb chat
# [Yes] to resume
# In file selection: Check only the 2 files you need today
# Press Enter
# Work with just those 2 files in memoryResult: Persistent context has 10 files, but only 2 are active in memory today.
| Command | Where it Acts | What it Does |
|---|---|---|
| Add files/directories | In-Memory | Adds files to current session |
| List current context (in-memory) | View | Shows what's active now |
| Show persistent context (saved state) | View | Shows what's saved to disk |
| Load persistent context into memory | Memory β Disk | Loads all saved files into session |
| Save in-memory context to persistent state | Disk β Memory | Saves current files to disk |
| Remove from in-memory context | In-Memory | Removes from current session |
| Clear all context | Both | Clears memory AND disk |
/contextload # Load saved context into memory
/contextsave # Save current memory to disk
/contextshow # Show persistent state details
/contextclear # Clear everything (memory + disk)
/contextrefresh # Re-scan repository
/contextremove # Remove specific file-
Start sessions with Yes if resuming project work
- You can always deselect files you don't need
-
Use in-memory for experiments
- Try loading different files without cluttering saved state
-
Save context before long breaks
- Use "Save in-memory to persistent" before ending work
-
Check what's loaded with
/context β List current context- Know what the AI can see
-
Use selective loading
- Don't load everything - just what you need today
-
Don't assume files are saved
- In-memory β persistent
- Explicitly save if you want to keep context
-
Don't load everything always
- Too much context = slower, more expensive
- Be selective
-
Don't forget to update persistent context
- If you add important files, save them for next time
Problem: Looking at wrong context type
Solution:
/context β List current context (in-memory) # β Use this one
# NOT "Show persistent context"Explanation: When you load files at startup, they go to in-memory context. Persistent context shows what's saved to disk, not what's currently active.
Problem: Files were in memory but not saved to persistent state
Solution: Next time, before closing AIWB:
/context β Save in-memory context to persistent stateExplanation: In-memory context is temporary. You must explicitly save to make it persistent.
Problem: Accumulated files over time
Solution:
# Option 1: Clear and start fresh
/contextclear
# Option 2: Selective loading
# At startup, only select the files you actually need
# Then save that smaller set:
/context β Save in-memory context to persistent stateAnswer: Only files in in-memory context
Check with:
/context β List current context (in-memory)Remember:
- Persistent context = saved for later
- In-memory context = active right now
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β IN-MEMORY CONTEXT PERSISTENT CONTEXT β
β (Temporary) (Saved) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β π Where: RAM π Where: Disk β
β β±οΈ Lasts: This session β±οΈ Lasts: Forever β
β π― Use: Active work π― Use: Save for later β
β ποΈ View: List current ποΈ View: Show persistent β
β β¨ Effect: In AI prompts β¨ Effect: Available later β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Flow:
Persistent β Load β In-Memory β Use in AI β Save β Persistent
πΎ π π€ πΎ
-
In-Memory = What's on your desk right now
-
Persistent = What's in your filing cabinet
-
Load files at startup β They go to in-memory (active)
-
Add files during session β They go to in-memory (not saved)
-
Save before closing β In-memory β Persistent (for next time)
-
Check
/context β List current contextto see what the AI can see -
Check
/context β Show persistent contextto see what's saved
Golden Rule: If the AI needs to see it, it must be in in-memory context.
For more help:
/help- General AIWB commands/context- Context management menudocs/USAGE.md- Full usage guide