mirror of
https://github.com/encounter/ghidra-cli.git
synced 2026-07-10 03:18:56 -07:00
1.5 KiB
1.5 KiB
Agent Instructions
Critical Rules
- NEVER SKIP TESTS! If Ghidra is not installed, the tests MUST fail.
- DEFAULT OUTPUT FORMAT should be human and agent readable, NOT JSON. Use
--jsonand--prettyfor JSON output.
Architecture
ghidra-cli uses a daemon-only architecture:
- All commands route through a daemon process
- Daemon manages a persistent Ghidra bridge connection
- Import/Analyze/Quick commands auto-start the daemon
- One daemon per project, one program per daemon
Key Patterns
Starting Analysis
# Quickest path - auto-starts daemon
ghidra quick ./binary
# Or explicit steps (daemon auto-starts on import)
ghidra import ./binary --project myproj --program prog
ghidra analyze --project myproj --program prog
Daemon is Always Running
After import/analyze/quick, the daemon is running. All query commands use it automatically:
ghidra function list # Uses daemon
ghidra decompile main # Uses daemon
ghidra find crypto # Uses daemon
Manual Daemon Control
ghidra daemon status # Check if running
ghidra daemon stop # Stop daemon
ghidra daemon restart --project p --program new_prog # Switch program
Code Organization
src/main.rs- CLI entry point, command routingsrc/daemon/- Daemon process, IPC server, command handlerssrc/ghidra/bridge.rs- Ghidra bridge connection managementsrc/ghidra/scripts/bridge.py- Python script running inside Ghidrasrc/ipc/- IPC protocol and client