Skip to content

Add a token count linter - #733

Open
aatuvai wants to merge 1 commit into
mainfrom
aatuvai/2026-07-01-token-count-linter
Open

Add a token count linter#733
aatuvai wants to merge 1 commit into
mainfrom
aatuvai/2026-07-01-token-count-linter

Conversation

@aatuvai

@aatuvai aatuvai commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Context

AI agents can process a limited amount of tokens at a time: this limit is called a context window. In order for an agent to keep all relevant information in its memory, the amount of tokens it reads should be manageable.

AI agents are actively reading the Teleport documentation and completing given tasks with the help of the docs. To prevent agents from filling their context window prematurely, overly long documentation pages should be prevented.

Summary

This PR adds a linter to ensure that the token count of any specific docs page does not surpass a pre-defined token count limit. Initially this limit is set to 30,000 tokens (the source for the amount is in this article)

Changes

  • Add the server/lint-token-count linter.
  • Add tests for the linter in server/lint-token-count.test.ts
  • Enable the linter in .remarkrc.mjs

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

Amplify deployment status

Branch Commit Job ID Status Preview Updated (UTC)
aatuvai/2026-07-01-token-count-linter b2928a2 4 ✅SUCCEED aatuvai-2026-07-01-token-count-linter 2026-07-01 11:35:52

@aatuvai
aatuvai force-pushed the aatuvai/2026-07-01-token-count-linter branch from ade4acf to 16347b6 Compare July 1, 2026 09:39
@aatuvai
aatuvai requested a review from ptgott July 1, 2026 11:21
@aatuvai
aatuvai marked this pull request as ready for review July 1, 2026 11:21
@aatuvai
aatuvai force-pushed the aatuvai/2026-07-01-token-count-linter branch from 7f78e62 to b2928a2 Compare July 1, 2026 11:26

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b2928a23c1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread server/lint-token-count.ts
@ptgott

ptgott commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Thanks! We'll need to fix the violations before we can merge this. There are two:

  • docs/pages/changelog.mdx
  • docs/pages/reference/audit-events.mdx

We could split up the audit event reference by editing the generator per this issue. We may need to ignore the changelog since it's closely coupled to engineering org practices.

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.

2 participants