|
| 1 | +# Schema Query Protocol: Graph Querying for Memory Protocol |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | +## Editors |
| 6 | + |
| 7 | +- [Irakli Gozalishvili], [Common Tools] |
| 8 | + |
| 9 | +## Authors |
| 10 | + |
| 11 | +- [Bernhard Seefeld], [Common Tools] |
| 12 | + |
| 13 | +## Abstract |
| 14 | + |
| 15 | +This RFC extends the [Memory Protocol] with graph querying capabilities that enable complex queries across fact relationships. The schema query protocol introduces the `/memory/graph/query` capability, which provides a different querying mechanism from the basic `/memory/query` capability, including reference resolution, graph traversal, and schema-aware operations. |
| 16 | + |
| 17 | +## Language |
| 18 | + |
| 19 | +The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119](https://www.rfc-editor.org/rfc/rfc2119). |
| 20 | + |
| 21 | +## Motivation |
| 22 | + |
| 23 | +The basic `/memory/query` capability in the [Memory Protocol] provides efficient fact retrieval but requires multiple roundtrips when working with references that point to other facts. Additionally, it returns complete facts even when only a subset of the data is needed. |
| 24 | + |
| 25 | +The schema query protocol reduces roundtrips by providing a single query capability that can follow cross-fact references and collect all relevant facts in a single response bundle. It uses schemas to determine which subset of fact data is actually needed, improving efficiency by excluding irrelevant fields. |
| 26 | + |
| 27 | +## Core Concepts |
| 28 | + |
| 29 | +### Reference Following |
| 30 | + |
| 31 | +Schema queries can follow cross-fact references during query execution, collecting related facts to build comprehensive result sets in a single roundtrip. |
| 32 | + |
| 33 | +### Bundled Responses |
| 34 | + |
| 35 | +Rather than requiring multiple queries to resolve cross-fact references, schema queries return bundled responses containing all relevant facts. |
| 36 | + |
| 37 | +### Schema-Based Filtering |
| 38 | + |
| 39 | +Schema queries use schemas to determine which portions of facts are actually needed. A fact may contain extensive data, but the schema specifies only the subset required for the query, reducing response size and improving performance. |
| 40 | + |
| 41 | +## Capabilities |
| 42 | + |
| 43 | +### `/memory/graph/query` |
| 44 | + |
| 45 | +*[Detailed specification to be completed]* |
| 46 | + |
| 47 | +This capability provides: |
| 48 | + |
| 49 | +- Automatic reference resolution |
| 50 | +- Graph traversal operations |
| 51 | +- Schema-aware filtering |
| 52 | +- Advanced aggregation functions |
| 53 | + |
| 54 | +## Integration with Cross-Fact References |
| 55 | + |
| 56 | +Schema queries are designed to work seamlessly with cross-fact references: |
| 57 | + |
| 58 | +- **References** are resolved to their target values during query execution |
| 59 | +- **Complex reference networks** can be traversed and queried as graph structures |
| 60 | + |
| 61 | +## Examples |
| 62 | + |
| 63 | +*[Examples to be provided in future versions]* |
| 64 | + |
| 65 | +## Implementation Requirements |
| 66 | + |
| 67 | +*[Implementation requirements to be specified]* |
| 68 | + |
| 69 | +## Future Work |
| 70 | + |
| 71 | +This specification is currently in draft status. Future versions will include: |
| 72 | + |
| 73 | +- Complete capability specification for `/memory/graph/query` |
| 74 | +- Detailed query language syntax |
| 75 | +- Performance optimization guidelines |
| 76 | +- Security considerations for cross-space graph queries |
| 77 | +- Integration examples with reference resolution |
| 78 | + |
| 79 | +[Common Tools]: https://common.tools/ |
| 80 | +[Irakli Gozalishvili]: https://github.com/gozala |
| 81 | +[Memory Protocol]: ./memory.md |
| 82 | + |
0 commit comments