Feat: Add Content Engineering#4
Draft
gh0sty02 wants to merge 3 commits into
Draft
Conversation
Implements backend/context/engineer.py with AGENT_BUDGET tables for rag_agent and orchestrator_node, tiktoken-based counting, and fit_short_term/fit_long_term/fit_chunks truncation that drops oldest turns and lowest-relevance items first. Adds backend/context/optimiser.py backed by llmlingua as a compression fallback when truncation alone would discard too much. Wires context engineer into rag_agent, orchestrator_node, rag_chain, llm.py (max_tokens=RESERVED_OUTPUT_TOKENS), and short_term.py (TOKEN_BUDGET derived from min AGENT_BUDGET cap). Long-term memory is now injected into plain rag-intent answers via assemble(). Per-source token counts and budget_exceeded flag are written back to SynapticState.
Adds ruff>=0.8.0 to backend/requirements.txt and backend/pyproject.toml (line-length 100, py312, rules E/F/I/UP/B, first-party import groups). Adds make lint / make lint-fix targets to the root Makefile. Applies all 34 ruff findings: import sorting (I001), unused imports (asyncio in memory_node, os in main), Optional[X] -> X | None (UP045), timezone.utc -> UTC (UP017), Sequence from collections.abc (UP035), and zip() strict=True where iterables are guaranteed equal length (B905). E402 late imports in agents/graph.py suppressed with noqa since they are required to break the SynapticState circular import.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.