Bound repository context size in load_repo_context

Open
#24 2 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@kpj2006 is already working on this.

Since Jul 30, 2026.

  • #45 by @rishiiicreates — closed without merging

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python
Domain
ai

Research direction

Start in repo_router.py at load_repo_context() and inspect how baseline, intent-matched .agent/**/*.md files, and README content are read and appended. Trace the existing README truncation and error logging before setting the shared per-file and total limits. Done means truncated sections are marked, both budgets are respected, and intent selection and routing behavior remain unchanged.

Written by the indexing model from the issue text.

Description

Summary

Add bounded Markdown context loading to repo_router.py so repository context passed to the LLM has predictable size.

Rationale

load_repo_context() currently reads baseline and intent-matched .agent/**/*.md files in full. Categorizing the query reduces the number of selected files, but a single large selected file can still consume the prompt budget, increase latency, and cause the user query or relevant context to be truncated.

Affected area

  • repo_router.py
  • load_repo_context()

Required changes

  • Introduce a shared capped-read helper for Markdown context files.
  • Apply a per-file content limit to operational data, architecture, core context, and instruction files.
  • Enforce an overall context-size budget while appending sections.
  • Preserve the existing intent-based selection and error logging behavior.
  • Mark truncated content clearly in the assembled context.

Acceptance criteria

  • No individual Markdown context file can exceed the configured per-file cap in the LLM context.
  • The assembled repository context cannot exceed a configured total budget.
  • Existing README truncation remains consistent with the shared limit strategy.
  • The existing routing and intent-selection behavior remains unchanged.

Backlinks

Requested by @kpj2006.

Dominant language
Python
Stars
10
Forks
12
Avg merge
3m
Merged PRs (30d)
1

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AOSSIE-Org/SkillBot

All issues in AOSSIE-Org/SkillBot

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.