Contex – semantic context routing for AI agents

(github.com)

2 points | by cahoots 2 hours ago

1 comments

  • cahoots 2 hours ago
    Hi HN! I built Contex to solve a problem I kept running into: tailoring project context for multiple specialized AI agents.

    When you have multiple agents (code reviewer, documentation writer, API assistant, etc), each needs different slices of your project's context. The naive approach is to dump the entire project into every agent's prompt, but that isn't scalable or efficient. The other option is to manually curate what each agent gets, but that comes with a lot of overhead.

    Contex uses semantic matching to automatically route relevant context. Agents describe what they need in natural language (i.e. "API configuration and endpoints"), and Contex finds and delivers matching data using sentence transformers + hybrid search.

    Key features:

    - Schema-free: Publish TOON, CSV, JSON, YAML, TOML, Markdown, or plain text

    - Real-time: Redis pub/sub or webhooks for instant updates

    - Event sourcing: Complete audit trail for debugging and compliance

    - Multi-project: Isolated namespaces with RBAC

    - Python SDK: pip install contex-python

    The interesting bits:

    1. Agents only get context they actually need (semantic similarity scoring)

    2. When you publish new data, agents automatically get notified if it's relevant

    3. Event sourcing lets you time-travel debug (i.e. "what did this agent know at 3pm?")

    It's MIT licensed and runs in Docker. We use it internally for a multi-agent coding system and it's been solid.

    Would love feedback on:

    - Is this a real problem for others building agent systems?

    - What other context routing patterns have you tried?

    - Are there use cases I'm missing?

    GitHub: https://github.com/cahoots-org/contex PyPI: https://pypi.org/project/contex-python/

    Happy to answer questions!