{
 "schema_version": 1,
 "generated": "2026-10-20",
 "id": "mksglu-context-mode--run-analysis-as-a-script",
 "repo": "mksglu/context-mode",
 "repo_url": "https://github.com/mksglu/context-mode",
 "repo_slug": "mksglu-context-mode",
 "title": "Count or summarize code with one script, not many reads",
 "page_title": "How to count or summarize code with one script, not many reads with Context Mode",
 "summary": "Have the agent write a short script that prints only the result, using ctx_execute.",
 "who": "A developer or reviewer who wants a quick count or summary across many source files without loading each file into the chat.",
 "problem": "Reading 50 files into context to count functions or lines uses far more context than the answer needs.",
 "outcome": "The agent runs one ctx_execute call and gets back only the printed summary, such as a line count per file.",
 "steps": [
  "Install Context Mode in Claude Code using the plugin steps from the README.",
  "Ask the agent to answer a question about many files by writing a script.",
  "Have the agent call ctx_execute with a javascript script that uses console.log() for the final result only.",
  "Check that the printed output matches a spot check on one or two files."
 ],
 "agent_prompt": "Using the context-mode ctx_execute tool, write a javascript script that lists each .ts file in <target-directory> with its line count and prints only those lines. Return the printed output and confirm the count for one file by reading it directly.",
 "agents": [
  "claude-code"
 ],
 "difficulty": "Intermediate",
 "time": "30 minutes",
 "basis": "readme",
 "caveat": "The README example uses fs and a src folder, so the script must match the file layout of the target project.",
 "category": "Software and DevOps",
 "tags": [
  "Software and DevOps"
 ],
 "lang": "typescript",
 "requirements": [
  "Claude Code v1.0.33+ for the plugin install, or Node.js >= 22.5 (or Bun) for the Gemini CLI setup",
  "An existing AI coding agent session in a project you want to work on"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [],
 "best": false,
 "score": 0.9,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/mksglu-context-mode/run-analysis-as-a-script/",
 "md": "https://dedupedai.com/use-cases/mksglu-context-mode/run-analysis-as-a-script/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/mksglu-context-mode--run-analysis-as-a-script.json",
 "api_version": "v1"
}
