This project uses the Serena MCP server for intelligent code navigation and editing. Follow these guidelines to maximize efficiency.
Prefer symbolic tools over file reads:
- Use
get_symbols_overviewfirst to understand a file's structure - Use
find_symbolwithinclude_body=falseto explore before reading - Only use
include_body=truewhen you need the actual implementation - Avoid reading entire files unless absolutely necessary
Symbol discovery workflow:
- Start with
get_symbols_overviewfor file structure - Use
find_symbolwithdepth=1to see class members - Use
find_referencing_symbolsto understand usage patterns - Only then read specific symbol bodies you need
Use the right tool for the job:
find_symbol- When you know the symbol name (supports substring matching)search_for_pattern- For arbitrary text patterns, non-code files, or unknown symbol namesfind_file- When looking for files by name/masklist_dir- For directory structure exploration
Pattern search tips:
- Always pass
relative_pathwhen you know the scope - Use
restrict_search_to_code_files=truefor code-only searches - Use
context_lines_before/aftersparingly to save tokens
Symbol-based editing (preferred):
- Use
replace_symbol_bodyfor modifying entire methods/functions/classes - Use
insert_after_symbolto add code after a symbol - Use
insert_before_symbolto add imports or code before a symbol - Always check references with
find_referencing_symbolsbefore renaming
When to use file-based editing:
- Small inline changes within a large method
- Non-code files (config, markdown, etc.)
- Files without clear symbol structure
Reading memories:
- Check
list_memoriesfor available project knowledge - Read memories that match your current task
- Don't read the same memory twice in a conversation
Writing memories:
- Document architectural decisions
- Record project-specific patterns and conventions
- Save information useful for future tasks
- Be incremental: Don't read more than you need
- Use depth parameter: Control how deep to explore symbol trees
- Scope your searches: Always provide
relative_pathwhen possible - Trust tool results: Don't verify successful operations unnecessarily
- Batch related operations: Make multiple independent calls in parallel
This is a TypeScript project. Keep in mind:
- Use name paths like
ClassName/methodNamefor methods - Constructors are named
constructorin symbol trees - Use
find_symbolwith substring matching for exported functions
Understanding a class:
1. get_symbols_overview(relative_path="src/engine/blackboard.ts")
2. find_symbol(name_path="BlackboardEngine", depth=1, include_body=false)
3. find_symbol(name_path="BlackboardEngine/post", include_body=true)
Finding usage of a method:
1. find_referencing_symbols(name_path="post", relative_path="src/engine/blackboard.ts")
Adding a new method to a class:
1. find_symbol(name_path="ClassName/lastMethod", relative_path="...")
2. insert_after_symbol(name_path="ClassName/lastMethod", body="new method code")
Safe refactoring:
1. find_referencing_symbols to understand all usages
2. Make changes ensuring backward compatibility OR update all references
3. Use rename_symbol for consistent renaming across codebase
IMPORTANT: These gates are BLOCKING REQUIREMENTS for every task involving code exploration, modification, or architectural decisions.
- MUST call
twining_assemblewith task description and narrowest scope BEFORE reading code or making changes - MUST call
twining_whyon files you intend to modify - NEVER start working without these calls — skipping creates blind decisions that conflict with existing work
- MUST call
twining_recordbefore everygit commitor session end — hooks enforce this - Include what you did (summary) and any choices you made (decisions array)
- Write decisions as natural sentences: "Chose X over Y — reason"
- For findings/warnings during work, use
twining_postdirectly
- Run
twining_housekeeping({})at the start of long sessions to check for stale state — preview is safe, execute only if needed
- Use narrowest scope:
src/auth/notproject - NEVER skip Gate 1 — #1 cause of wasted work and conflicting decisions
- NEVER skip Gate 2 — hooks will block your commit and session exit until you record