Thenos Code
Compiler-grade frontend engineering intelligence for production applications.
Thenos Code is a local-first VS Code extension that analyzes JavaScript, TypeScript, React, and Next.js projects for architecture risk, rendering pressure, bundle cost, Lighthouse readiness, hydration pressure, motion performance, and deterministic refactor opportunities.
It is not a chatbot, autocomplete wrapper, or generic coding assistant. The core system is deterministic: source analysis, graph building, scoring, reporting, restore points, and safe refactor previews run locally.
Core Idea
Thenos Code combines:
- Static project scanning
- TypeScript AST analysis
- Architecture and dependency graphs
- React and hydration intelligence
- Bundle and import-cost intelligence
- Rendering and motion optimization heuristics
- Production optimization reports
- Local AI Engineer Chat
- Safe preview-before-apply refactors
- Local Ollama planning for optional AI orchestration
AI is used for planning and explanation only. Runtime, rendering, bundle, visual, and architecture signals come from deterministic infrastructure.
Privacy Model
- Source code stays on the developer machine.
- No cloud service is required for core intelligence.
- Ollama integration is local and optional.
- Refactors create restore points before changes are applied.
- Broad or risky edits are previewed before apply.
Requirements
- VS Code
^1.90.0
- Node.js with npm
- Local workspace folder opened in VS Code
- Optional: Ollama running locally for AI planning
Recommended local Ollama model:
ollama pull qwen2.5-coder:14b
Local Development
Install dependencies:
npm install
Compile the extension:
npm run compile
Watch TypeScript during development:
npm run watch
Launch the extension host:
- Open this repository in VS Code.
- Press
F5.
- Run
Thenos: Scan Project from the command palette in the extension host.
Packaging
Build a Marketplace-ready VSIX:
npm run package
The generated package is:
thenos-code-0.4.0.vsix
Publish to Marketplace after setting up a publisher token:
npm run publish:marketplace
Do not publish without checking:
npm run compile
npm run package
CHANGELOG.md version entry
README.md command list and feature descriptions
package.json version and Marketplace metadata
Ollama Integration
Thenos uses the OpenAI-compatible Ollama endpoint:
http://127.0.0.1:11434/v1/chat/completions
Default model:
qwen2.5-coder:14b
Check installed Ollama models:
curl http://127.0.0.1:11434/api/tags
Important: /v1/chat/completions is an internal POST-only chat endpoint. Do not use it as a browser status page. Use one of these instead:
- Run
Thenos: Show Ollama Status
- Click
Ollama in the Thenos dashboard
- Click
Ollama in AI Engineer Chat
- Open
http://127.0.0.1:11434/api/tags
VS Code settings:
thenos.ollama.endpoint
thenos.ollama.model
thenos.ollama.temperature
thenos.ollama.timeoutMs
Architecture
Current source layout:
src/
agents/ Local AI orchestration and multi-agent planning
analysis/ Static analysis engines and project report composition
architecture/ System blueprint and capability metadata
benchmark/ Benchmark foundations
bundle/ Bundle impact analysis
core/ Project scanning
dashboard/ VS Code webview dashboard
assistant/ Local Ollama AI Engineer Chat webview
editor/ Diagnostics, hovers, code lenses, and editor actions
graphs/ Context graph and related-file intelligence
history/ Timeline and restore point storage
memory/ Official optimization knowledge anchors
motion/ GSAP, Lenis, and motion risk analysis
react/ React rerender pressure analysis
refactor/ Safe AST-aware refactor previews and apply flow
rendering/ Paint, layout, compositing, and FPS-oriented analysis
reporting/ Markdown report generation
runtime/ Playwright route scanner foundation
services/ Ollama client and service integrations
testing/ Self-test command detection and execution
types/ Shared TypeScript contracts
utils/ Shared utilities
visual/ Visual regression comparison
Main Commands
Thenos: Scan Project
Thenos: Autonomous Scan
Thenos: Optimize File
Thenos: Reduce Bundle Size
Thenos: Analyze Architecture
Thenos: Detect Complexity Issues
Thenos: Optimize Rendering
Thenos: Generate Engineering Report
Thenos: Open AI Engineer Chat
Thenos: AI Fix Active File
Thenos: Generate Production Optimization Report
Thenos: Open Context Graph
Thenos: Open File Intelligence
Thenos: Check Ollama Connection
Thenos: Show Ollama Status
Thenos: Generate Local AI Plan
Thenos: Safe Refactor Component
Thenos: Fix with Thenos
Thenos: Apply Input Refactor
Thenos: Set Optimization Mode
Thenos: Rollback Last Optimization
Thenos: Show Line Suggestion
Shortcuts
Ctrl+Alt+T / Cmd+Alt+T: apply a deterministic Thenos fix on the active line when available.
Ctrl+Alt+I / Cmd+Alt+I: open input-driven deterministic refactor.
Ctrl+Shift+Alt+T and Ctrl+Shift+Alt+I: alternate shortcuts for systems where Ctrl+Alt is intercepted.
Reports
Thenos: Generate Engineering Report creates a full project report with:
- Engineering scores
- Before/after potential
- Engine metrics
- Top risky files
- Prioritized optimization queue
- All findings
Thenos: Generate Production Optimization Report creates a production-focused report with:
- Lighthouse readiness
- Smoothness score
- GPU safety
- Hydration discipline
- Bundle discipline
- SEO readiness
- Accessibility readiness
- Memory discipline
- GSAP, Lenis, Motion, Three.js, Next.js, React, Redux, bundle, and runtime optimization surfaces
Thenos: Open Context Graph creates related-file intelligence for:
- Imports
- Exports
- Parent files
- Child files
- Hooks
- Styles
- Routes
- Animation surfaces
- Shared utilities
- Coupling score
AI Engineer Chat
Thenos: Open AI Engineer Chat opens a local Ollama-powered productivity chat inside the Thenos activity bar.
The chat can help with:
- Active-file architecture review
- Production optimization planning
- React rerender and hydration analysis
- GSAP, Lenis, Motion, and Three.js performance guidance
- Bundle reduction strategy
- Lighthouse improvement planning
- Safe refactor planning
- Explaining the latest Thenos scan findings
The chat includes a context toggle. When enabled, Thenos sends only local context to Ollama:
- Workspace path
- Active supported source file path
- Active selection or nearby file excerpt
- Latest Thenos scan summary when available
The chat does not apply edits directly. For code changes, use the existing Thenos preview/refactor commands so restore points and rollback remain in control.
AI Fix Active File
Thenos: AI Fix Active File uses local Ollama to inspect the active file and VS Code diagnostics, then drafts a full-file patch.
Workflow:
- Open a supported source file.
- Run
Thenos: AI Fix Active File.
- Thenos asks Ollama for a minimal production-grade patch.
- VS Code opens a diff preview.
- Choose
Apply Patch or Reject.
- If accepted, Thenos creates a restore point, updates the file, saves it, and verifies the file changed.
Supported file types:
- TypeScript
- TypeScript React
- JavaScript
- JavaScript React
- JSON / JSONC
- CSS / SCSS / LESS
- Markdown
This command is intentionally accept/reject driven. It does not silently mutate files.
Safe Refactor Model
Thenos can apply deterministic fixes, but it follows a guarded workflow:
- Analyze the current file or workspace.
- Generate a deterministic refactor plan.
- Show a diff preview for larger changes.
- Create an Engineering Restore Point before applying.
- Apply the edit.
- Offer rollback after apply.
Rollback command:
Thenos: Rollback Last Optimization
Optimization Modes
Safe: low-risk deterministic optimizations only.
Engineering: moderate structure improvements with preview.
Aggressive: deeper restructuring when deterministic plans exist.
Compiler: maximum local optimization within safe AST limits.
Developers can guide deterministic refactors with comments:
// thenos-optimize
// thenos-reduce-bundle
// thenos-improve-complexity
// thenos-fix-rerenders
Production Optimization Scope
Thenos currently analyzes:
- Next.js server/client boundary misuse
- Hydration-heavy route and client surfaces
- Heavy route-level browser dependencies
- React rerender pressure
- Context propagation pressure
- Effect-driven fetching
- GSAP layout and paint-heavy animation risks
- ScrollTrigger lifecycle risks
- Lenis RAF and cleanup risks
- Motion LazyMotion and layout animation opportunities
- Three.js DPR, draw-call, texture, and disposal risks
- Lighthouse, SEO, and accessibility heuristics
- Event listener, interval, and RAF cleanup risks
- Bundle duplication and route chunk inflation signals
Official Knowledge Anchors
The production optimization rules are aligned with patterns from:
- Next.js:
https://nextjs.org/docs
- React:
https://react.dev/
- GSAP:
https://gsap.com/docs/
- Lenis:
https://github.com/darkroomengineering/lenis
- Motion:
https://www.framer.com/motion/
- Three.js:
https://threejs.org/docs/
- Redux Thunk:
https://redux.js.org/usage/writing-logic-thunks
Marketplace Notes
The extension package excludes:
- Source TypeScript
- Existing
.vsix builds
- Zip archives
- Workspace/editor metadata
- TypeScript source maps
Packaging config lives in:
.vscodeignore
The current package is intentionally local-first and does not require external AI APIs.
Developer Checklist
Before publishing:
npm run compile
npm run package
Then verify:
- The generated VSIX installs in a clean VS Code profile.
Thenos: Scan Project completes on a sample project.
Thenos: Generate Production Optimization Report opens a markdown report.
Thenos: Check Ollama Connection succeeds when Ollama is running.
Thenos: Show Ollama Status lists local models and offers the browser-safe status URL.
Thenos: Generate Local AI Plan falls back gracefully when Ollama is unavailable.
Thenos: Rollback Last Optimization restores the latest restore point after an applied refactor.
Current Scope
Thenos Code focuses on local engineering intelligence:
- No login
- No cloud dependency for core analysis
- No source upload
- Deterministic scanning and scoring
- Optional local Ollama planning
- Preview-before-apply refactors
- Rollback infrastructure
Future work can add CI integration, team dashboards, benchmark history, GitHub workflows, richer visual regression, and enterprise reporting while preserving the local-first core.