Glassbrain: Knowledge Graph Structure, Validation, and Visualization Tool
Glassbrain enables users to explore, validate, and visualize knowledge graphs maintained by agents, using hierarchical nodes and edges to represent code, documentation, and relationships.
Knowledge Graph Structure and Format
Glassbrain enables users to explore the knowledge graphs maintained by their agent, which include representations of code, documentation, research, and internal planning. These graphs are structured as hierarchical nodes and edges, with nodes representing files, folders, or other entities, and edges indicating relationships such as 'uses.' The format is defined directly by the agent, without reliance on external libraries or APIs. For example, a node might represent a file like 'login.ts,' with a parent folder specified, and edges might show how 'login.ts' interacts with other files, such as 'db.ts' through a 'uses' relationship. According to Hacker News Show, Glassbrain also introduces stable structure and version comparison capabilities, ensuring consistency and traceability in knowledge representation over time.
Validation and Diffing Capabilities
The Glassbrain tool provides validation and diffing capabilities that help ensure the integrity of knowledge graphs built by agents. Using the CLI, users can validate a graph with commands like npx glassbrain validate kg, which checks for errors and warnings, such as dangling edges pointing to missing nodes. The tool also supports diffing between graph versions, highlighting changes in nodes and edges. For example, npx glassbrain diff kg/1-skeleton kg/2-filled shows that one edge was added and one node's description was modified. These features allow agents to build graphs incrementally, validate each step, and confirm that changes align with expected outcomes. The CLI offers options like --strict to treat warnings as errors and --json for structured output, ensuring clarity and precision in the validation process.
Graph Visualization and Integration
Glassbrain enables developers to visualize and integrate agent knowledge through graph-based representations. By using npx glassbrain, users can show the architecture of an agent's memory before and after changes, organized into layers for clarity. The tool supports embedding the graph component in custom applications via npm i glassbrain cytoscape cytoscape-fcose cytoscape-cose-bilkent, allowing developers to import and display knowledge graphs with GraphCanvas. This approach facilitates browsing and comparing models using diffModels, providing a visual way to track changes in agent knowledge. Customization options, including colors, layers, and fields, are detailed in the guide, offering flexibility for integration into various applications. The method is described in Hacker News Show as a way to 'read it like a brain scan,' emphasizing the tool's ability to represent complex data structures in an intuitive format.
Use Cases and Real-World Applications
The Glassbrain tool offers a range of use cases and real-world applications, particularly in the realm of agent development and collaboration. By converting documentation and user interface code into a knowledge graph, it identifies 268 features across nine areas, each represented as a user story with defined steps and expected results Hacker News Show. This structured approach aids in tracking the evolution of an agent-ecosystem graph, which expanded from 130 to 166 nodes, with 25 remembered facts corrected based on external verification Hacker News Show. Furthermore, the tool supports real-time collaboration by linking every decision to its corresponding requirement and documenting rejected alternatives. A recent self-review process added 8 nodes, demoted one decision to rejected, and modified 9 others, demonstrating its capacity for iterative refinement Hacker News Show.
Editing and Version Control
Glassbrain introduces a novel approach to editing and version control in agent-based systems by treating edits as a series of small, replayable operations. According to Hacker News Show, these edits are structured as patches, enabling the system to reconstruct the graph even after the agent regenerates it. This method ensures that changes are traceable and reversible, enhancing transparency in the development process. Hacker News Show clarifies that the graph is not directly edited by the user but is instead generated by external components such as the agent, Graphify, or a script, with Glassbrain serving as the interface for visualizing and monitoring these changes. Additionally, Hacker News Show highlights discrepancies between documentation and application content, noting that 49 items are missing from the docs, 93 are exclusive to the docs, and 94 stories explicitly point out differences between the two. These findings underscore the importance of maintaining alignment between documentation and implementation in complex systems.
Sources and reporting notes
Based on published source material. No independent hands-on testing is claimed.