* fix(reflect): prevent context_length_exceeded on large memory banks (#457) The reflect agent's agentic loop accumulated tool-call messages across iterations with no upper bound on token count, causing context_length_exceeded errors on banks with 19K+ nodes. Changes: - Add proactive token-budget guard: before each call_with_tools, count accumulated message tokens via tiktoken; if >= max_context_tokens and evidence has been gathered, immediately synthesize from what was found - Detect context-overflow errors specifically (_is_context_overflow_error) and skip the retry path — retrying after overflow only makes it worse - Truncate context_history in build_final_prompt to a 60K-token budget so the fallback synthesis prompt itself cannot overflow - Add HINDSIGHT_API_REFLECT_MAX_CONTEXT_TOKENS config (default 100000) wired through config.py → main.py → memory_engine → run_reflect_agent - Tests: unit tests for helpers + mock-LLM behavior tests + an end-to-end integration test using a real LLM with max_context_tokens=1 * fix(reflect): derive final prompt context budget from max_context_tokens Replace the hardcoded _FINAL_PROMPT_CONTEXT_BUDGET (60K tokens) with a fraction of max_context_tokens (80%), so the fallback synthesis prompt automatically scales with whatever context window is configured. |
||
|---|---|---|
| .. | ||
| blog | ||
| docs | ||
| examples | ||
| src | ||
| static | ||
| versioned_docs | ||
| versioned_sidebars | ||
| .gitignore | ||
| docusaurus.config.ts | ||
| package.json | ||
| README.md | ||
| sidebars.ts | ||
| tsconfig.json | ||
| versions.json | ||
Website
This website is built using Docusaurus, a modern static website generator.
Installation
npm install
Local Development
npm start
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
Build
npm run build
This command generates static content into the build directory and can be served using any static contents hosting service.
Deployment
Using SSH:
USE_SSH=true npm run deploy
Not using SSH:
GIT_USER=<Your GitHub username> npm run deploy
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the gh-pages branch.