Reduce system prompt token overhead from skill files

Open
#26 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript
Domain
ai

Research direction

Inspect load_all_skills() and the referenced mechanical-illustration-skill.txt and svg-shape-library.txt files, then measure the current skill-text token usage. Compare the suggested loading, trimming, and budget approaches; done means irrelevant skills are excluded for non-mechanical queries and the total skill text meets a defined target.

Written by the indexing model from the issue text.

Description

enhancement

Priority: P1 | Source: PR #21 self-review (F2)

Problem

PR #21 adds ~9,150 tokens (75% increase) to the system prompt. load_all_skills() concatenates ALL .txt files unconditionally — mechanical diagram guidance is injected even for non-mechanical queries.

  • Pre-PR skill text: ~48.9 KB (~12,200 tokens)
  • Post-PR skill text: ~85.5 KB (~21,400 tokens)

Suggested Approaches

  • Conditional skill loading — only inject mechanical-illustration-skill.txt and svg-shape-library.txt when the query involves physical/mechanical subjects
  • Trim the shape library to the 6-8 most common shapes (as the issue proposal itself suggests)
  • Establish a token budget target for total skill text
Dominant language
TypeScript
Stars
1.6k
Forks
202
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

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 CopilotKit/OpenGenerativeUI

All issues in CopilotKit/OpenGenerativeUI

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.