How foxlendor/twinthink works
TwinThink is a platform for compiling, validating, and sharing digital twins of physical inventions. Its main workflow runs from creator input and twin ingestion through canonical twin/BOM modeling, validation and simulation, then persistence and inspection or export. The repository also documents a browser UI, cryptographic identity and portable bundles, and an MCP interface. Edges are limited to relationships shown in the excerpts, SOURCE INDEX references, or README; some UI/API wiring and unsampled capabilities are therefore shown without speculative call paths.
Main entry points: service.py Twin service · main.py HTTP API · engine.py Twin ingestion · page.tsx Web application
Components 21
User interfaces
- Web application
apps/web/src/app/page.tsx - Twin viewer
apps/web/src/components/TwinViewer.tsx - ShadowField
apps/web/src/components/shadowfield/ShadowField.tsx - HTTP API
apps/api/main.py - CLI
apps/api/tt.py - MCP server
packages/twinthink/mcp/server.py
Twin lifecycle
- Twin ingestion
packages/twinthink/factory/engine.py - Twin schema
packages/twinthink/schema.py - Twin service
packages/twinthink/service.py - Twin validator
packages/twinthink/validator.py
Engineering analysis
- BOM engine
packages/twinthink/bom/engine.py - Reality scoring
packages/twinthink/reality/calculator.py - Calibration
packages/twinthink/simulation/calibration.py - Thermal simulation
packages/twinthink/simulation/thermal.py - Flow model
packages/twinthink/simulation/flow.py
Trust and exchange
- Creator identity
packages/twinthink/crypto/identity.py - Signed revisions
packages/twinthink/crypto/revision.py - Encrypted segments
packages/twinthink/crypto/envelope.py - Portable bundles
packages/twinthink/crypto/bundle.py
Persistence
- Local SQLite
Other components
- Creator
Connections 30
- Creator → Web application: uses
README.md - Creator → HTTP API: submits twins
README.md - Web application → Twin viewer: previews
- Web application → ShadowField: explores
- Web application → HTTP API: requests data
- HTTP API → Twin ingestion: ingests
- HTTP API → Twin validator: validates
apps/api/main.py - HTTP API → Thermal simulation: simulates
apps/api/main.py - HTTP API → Flow model: uses
apps/api/main.py - HTTP API → Calibration: calibrates
apps/api/main.py - HTTP API → Local SQLite: persists
README.md - CLI → Twin service: delegates
apps/api/tt.py - MCP server → Twin service: delegates
packages/twinthink/mcp/server.py - Twin service → Twin schema: uses
packages/twinthink/service.py - Twin service → BOM engine: parses BOM
packages/twinthink/service.py - Twin service → Thermal simulation: simulates
packages/twinthink/service.py - Twin service → Flow model: uses
packages/twinthink/service.py - Twin service → Calibration: calibrates
packages/twinthink/service.py - Twin ingestion → Twin schema: builds
packages/twinthink/factory/engine.py - Twin ingestion → Reality scoring: scores
packages/twinthink/factory/engine.py - Twin ingestion → Calibration: compares
packages/twinthink/factory/engine.py - Twin ingestion → BOM engine: constructs
packages/twinthink/factory/engine.py - Thermal simulation → Flow model: reads timeline
packages/twinthink/simulation/thermal.py - Thermal simulation → Creator identity: uses PCM
- Twin service → Creator identity: signs identity
packages/twinthink/service.py - Twin service → Signed revisions: records revisions
packages/twinthink/service.py - Twin service → Portable bundles: exports bundles
packages/twinthink/service.py - Portable bundles → Creator identity: verifies identity
packages/twinthink/crypto/bundle.py - Portable bundles → Signed revisions: verifies revisions
packages/twinthink/crypto/bundle.py - Portable bundles → Encrypted segments: uses encryption
packages/twinthink/crypto/bundle.py