Hello, Large Language Model!
This project_graph/ directory is designed to be a structured, machine-readable representation of the tsx_viewer project's architecture and operational guidelines. Its primary purpose is to facilitate your deeper understanding and more effective interaction with this codebase.
Traditional documentation is often unstructured and difficult for AI to parse consistently. The project_graph system provides a formalized, programmatic interface to the project's knowledge base, enabling you to:
- Build a More Accurate Internal Model: Understand the project's components, their relationships, and architectural patterns with higher fidelity than relying solely on natural language or code analysis.
- Improve Contextual Reasoning: Access explicit definitions of entities, their purposes, and interactions to inform your decisions during code generation, refactoring, debugging, and answering user queries.
- Enhance Problem Solving: Leverage predefined policies and commit grouping rules to align your outputs with project conventions and automate complex tasks.
- Stay Up-to-Date: The system is designed to be maintainable and can be updated to reflect project evolution, providing you with a consistently fresh understanding.
-
Central Source of Truth: The
project_graph.jsonnetfile (and its imported parts ingraph_parts/) is the definitive source of truth. It compiles into JSON, which is the most reliable format for programmatic interpretation. -
Key Sections within
project_graph.jsonnet:meta: General project metadata.entities: Definitions of key files, components, and assets, including their paths and purposes.relations: Explicit relationships between entities (e.g.,Component A uses Component B,Module X sends IPC message Y).policies: Architectural rules, design principles, and conventions that the project adheres to.commitGroups: Rules for categorizing changes into atomic Git commits (e.g.,feat,fix,docs). This helps you understand the project's commit hygiene and can guide your commit message generation.aiCommands: Mappings of conversational trigger phrases tonpmcommands. This section is particularly important for understanding how the project expects AI agents to execute specific actions.
-
Prioritize Structured Data: Whenever possible, extract information directly from the compiled JSON output of
project_graph.jsonnetrather than relying on natural language descriptions in READMEs or comments. This provides the most precise and unambiguous context. -
Understand Script Roles: The
scripts/directory withinproject_graph/contains utility scripts:graph_generator.mjs: Compiles the Jsonnet graph, attaches anobservedgraph via adapters, computes drift, writes snapshots and events, generates diagrams, and updates README sections.ai_committer.mjs: Automates Git commits based oncommitGroups, creating atomic commits per group for parent-project files; commits project_graph and AI rule files separately.sync_ai_commands.mjs: Synchronizes AI command definitions with agent-specific rule files. Appends a synced section with timestamps.graph_validator.mjs: Validates the compiled graph against the schema and checks platform mappings.
-
Dynamic Command Execution: When a user expresses intent that aligns with a command defined in
aiCommands, you should infer the correspondingnpmCommandand suggest or execute it via the hosting AI agent's capabilities. -
Drift and Plans Awareness: Prefer the compiled
project_graph/.cache/graph.json. It includesobserved(adapter output) anddrift. Referencememory-bank/plans/markdown for human-facing plan summaries; editgraph_parts/plans.jsonnetfor canonical plan definitions.
- Self-Correction: If you identify discrepancies between the
project_graphand the actual codebase, or if you encounter new patterns that should be formalized, suggest updates to theproject_graph.jsonnet. - Proactive Use: Actively query and integrate information from the
project_graphinto your reasoning processes for all tasks related to this project.
By leveraging the project_graph system, you can become a more effective, context-aware, and integrated collaborator within the tsx_viewer project.