feat: add POST /search endpoint to HTTP server
What this does
Adds a POST /search endpoint to the HTTP server (cce serve --http), exposing the hybrid retrieval pipeline for custom agent integrations.
The gap
cce serve --http currently only exposes /ingest and /health — there's no way to query an indexed project over HTTP. The cce search CLI works, but requires subprocess management and produces human-readable text output rather than structured data.
Custom Python agents (not Claude Code) that want to use CCE for semantic code search currently have two bad options: parse CLI text output, or re-implement the retrieval pipeline themselves.
The change
One file changed (~35 lines). Adds handle_search to ContextEngineHTTP as a thin wrapper around the existing HybridRetriever pipeline — the same path the context_search MCP tool already uses internally.
POST /search
Content-Type: application/json
{"query": "cost tracking", "top_k": 5}
Response:
{
"results": [
{
"id": "b1294739d28245a1",
"file_path": "memory/journal.py",
"start_line": 81,
"end_line": 86,
"content": "def record_usage(model, provider, input_tokens, ...)",
"chunk_type": "function",
"language": "python",
"confidence_score": 0.878,
"metadata": {"_distance": 0.774}
}
]
}
Real-world test
Tested live against an indexed Python project on my instance of a Hermes agent — a personal AI assistant that clones repos to a VPS and queries them for code analysis. Query "cost tracking", top_k=3 returned three correctly ranked functions across two files with confidence scores. Matches the results from cce search CLI.
Background
I've been using CCE inside my Hermes agent to give it semantic search over cloned repos, getting ~93% token reduction compared to reading full files (400 tokens served vs 6,151 full file tokens on a real query). This endpoint makes that integration cleaner and opens the same pattern to any agent framework that speaks HTTP.
No new logic, no new dependencies, no new commands. Just surfaces what's already there.