Implemented 4 out of 13 verification comments. The remaining 9 comments require additional decisions and test alignment.
Problem: Direct imports of MCP server functions bypass async handling and ignore MCP protocol.
Solution:
- Created
.codex/tools/codex_mcp_client.py- thin subprocess client - Updated
CodexBackend.manage_tasks(),search_web(),fetch_url()to use MCP client - All tools now invoked via
codex tool <server>.<tool>command - Proper async handling and error response parsing
Files Changed:
amplifier/core/backend.py(updated 3 methods).codex/tools/codex_mcp_client.py(new file)
Problem: Invalid import path using sys.path hacks; .codex not an importable package.
Solution:
- Created
amplifier/codex_tools/package - Moved
agent_context_bridge.pytoamplifier/codex_tools/ - Created proper
__init__.pywith exports - Updated imports in
agent_backend.py - Removed sys.path manipulation
Files Changed:
amplifier/codex_tools/__init__.py(new)amplifier/codex_tools/agent_context_bridge.py(moved)amplifier/core/agent_backend.py(updated imports)
Problem: Duplicate --context-file flags; unclear separation of agent definition vs context.
Solution:
- Changed
--context-fileto--agentfor agent definition - Changed second
--context-fileto--contextfor session context - Properly initialized
context_filevariable to avoid undefined errors - Clear separation:
--agent=<agent.md>for definition,--context=<ctx.json>for session data
Files Changed:
amplifier/core/agent_backend.py(spawn_agent method)
Problem: Missing auto_save.py and auto_check.py referenced in wrapper.
Solution:
- Files already existed but had linting errors (E402 - module imports not at top)
- Added
# noqa: E402comments to both files - Verified functionality - both scripts properly use BackendFactory
Files Changed:
.codex/tools/auto_save.py(linting fix).codex/tools/auto_check.py(linting fix)
Issue: Tasks saved to server folder, not .codex/tasks/
Requires: Config reading, path normalization
Issue: Missing flag in wrapper Requires: Bash argument parsing, prerequisite check refactor
Issue: API divergence between implementation and tests Requires: Decision on implementation approach (add classes vs update tests)
Issue: Inconsistent response schemas Requires: Response shape standardization, test updates
Issue: Returns success: True for native tools where tests expect success: False
Requires: Contract decision and test alignment
Issue: Method only in CodexAgentBackend, not in AmplifierBackend Requires: Abstract method addition, dual implementation
Issue: MCP servers don't read config values Requires: Config loading in server init, remove hardcoded values
Issue: Prints all tools regardless of which are enabled Requires: Config parsing, conditional display
Issue: No error handling for missing prerequisites Requires: Prerequisite checks, Python exception catching
- Run make check to verify current fixes don't introduce new linting errors
- Make architectural decisions for remaining comments:
- Comment 7: Which API design to use?
- Comment 9: What should "native" tools return?
- Implement remaining fixes in priority order:
- High: Comments 4, 8, 11 (core functionality)
- Medium: Comments 10 (API completeness)
- Low: Comments 6, 12, 13 (UX improvements)
- Update tests to match new implementations
- Document in DISCOVERIES.md
- MCP Protocol over Direct Imports: Using subprocess + JSON protocol is more robust than direct function imports
- Package Structure Matters: Proper Python packages avoid sys.path hacks and make imports cleaner
- CLI Flag Clarity: Separating concerns (agent vs context) via distinct flags prevents confusion
- Linting in CI: Some linting rules (E402) need context-aware suppression
.codex/tools/codex_mcp_client.pyamplifier/codex_tools/__init__.pyamplifier/codex_tools/agent_context_bridge.py(moved)IMPLEMENTATION_SUMMARY.mdVERIFICATION_FIXES_SUMMARY.md
amplifier/core/backend.pyamplifier/core/agent_backend.py.codex/tools/auto_save.py.codex/tools/auto_check.py