Skip to content

Feat: Add Content Engineering#4

Draft
gh0sty02 wants to merge 3 commits into
mainfrom
feat/context-engineering
Draft

Feat: Add Content Engineering#4
gh0sty02 wants to merge 3 commits into
mainfrom
feat/context-engineering

Conversation

@gh0sty02

Copy link
Copy Markdown
Owner

No description provided.

gh0sty02 added 3 commits July 14, 2026 08:54
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant