Logic Tools

Store, query, and reason over structured facts without a database or LLM call.

Logic cells

Every operation below runs inside a logic cell โ€” a per-user symbolic fact space. Each cell has a persistent layer for durability and a symbolic layer for sub-millisecond query execution. When you call any logic.* tool, the system ensures your cell is ready: facts are loaded into the symbolic engine automatically so queries execute instantly with no LLM calls and no external round-trips.

Facts inside a logic cell are typed (entity, attribute, relation, metric, tag, context, constraint) and can be stored from natural language or passed directly as structured maps. Once stored, they persist across sessions โ€” an agent that stores a fact today can query it tomorrow without re-learning it.

All Logic tools are available at data-grout@1/logic.*@1.


logic.remember@1

Store one or more facts. Facts are natural language statements or structured key-value pairs that you want to recall later. Each fact gets a unique handle you can use to retract it.

Parameters

Parameter Type Required Default Description
statement string conditionally โ€“ A single fact as a natural language statement. Provide either statement or facts, not both
facts array conditionally โ€“ An array of structured facts to store in batch
tag string no โ€“ A label to group related facts (e.g. "project-alpha", "user-preferences")

Example: single fact

{
  "name": "data-grout@1/logic.remember@1",
  "arguments": {
    "statement": "The billing contact for Acme Corp is jane@acme.com",
    "tag": "contacts"
  }
}

Example: batch facts

{
  "name": "data-grout@1/logic.remember@1",
  "arguments": {
    "facts": [
      { "entity": "Acme Corp", "attribute": "billing_contact", "value": "jane@acme.com" },
      { "entity": "Acme Corp", "attribute": "plan", "value": "enterprise" },
      { "entity": "Globex", "attribute": "billing_contact", "value": "bob@globex.com" }
    ],
    "tag": "contacts"
  }
}

Response:

{
  "stored": 3,
  "handles": ["fact_a1", "fact_a2", "fact_a3"]
}

logic.query@1

Retrieve facts. Ask a question in natural language or provide structured patterns to match against. Queries execute against the symbolic layer at sub-millisecond latency.

Parameters

Parameter Type Required Default Description
question string conditionally โ€“ A natural language question. Provide either question or patterns, not both
patterns array conditionally โ€“ Structured match patterns (e.g. [{ "entity": "Acme Corp" }])
limit integer no 50 Maximum number of results to return

Example: natural language

{
  "name": "data-grout@1/logic.query@1",
  "arguments": {
    "question": "Who is the billing contact for Acme Corp?"
  }
}

Response:

{
  "results": [
    {
      "handle": "fact_a1",
      "statement": "The billing contact for Acme Corp is jane@acme.com",
      "tag": "contacts"
    }
  ]
}

Example: pattern match

{
  "name": "data-grout@1/logic.query@1",
  "arguments": {
    "patterns": [{ "attribute": "billing_contact" }],
    "limit": 10
  }
}

Returns all facts with a billing_contact attribute across all entities.


logic.constrain@1

Store a rule or policy that applies to future queries and workflows. Constraints are persistent and affect how the system reasons about your facts.

Parameters

Parameter Type Required Default Description
rule string yes โ€“ The rule to store, as a natural language statement
tag string no โ€“ A label to group related constraints

Example

{
  "name": "data-grout@1/logic.constrain@1",
  "arguments": {
    "rule": "Enterprise customers must have a billing contact before creating invoices",
    "tag": "billing-policy"
  }
}

Subsequent plans and queries will respect this constraint. For example, a workflow that creates an invoice for an enterprise customer without a billing contact on file would flag a policy violation.


logic.forget@1

Retract facts from your fact space. Provide specific fact handles or a pattern to match against.

Parameters

Parameter Type Required Default Description
handles array conditionally โ€“ Array of fact handles to retract (e.g. ["fact_a1", "fact_a2"]). Provide either handles or pattern, not both
pattern string conditionally โ€“ A match pattern to retract all matching facts (e.g. "entity:Acme Corp")

Example: by handle

{
  "name": "data-grout@1/logic.forget@1",
  "arguments": {
    "handles": ["fact_a1"]
  }
}

Example: by pattern

{
  "name": "data-grout@1/logic.forget@1",
  "arguments": {
    "pattern": "entity:Globex"
  }
}

Retracts all facts about the entity โ€œGlobexโ€.


logic.reflect@1

Get a summary of what the system knows about an entity or across your entire fact space. Useful for auditing stored knowledge or debugging unexpected behavior.

Parameters

Parameter Type Required Default Description
entity string no โ€“ Focus reflection on a specific entity. Omit to reflect on the full fact space
summary_only boolean no false Return only a high-level summary instead of listing individual facts

Example

{
  "name": "data-grout@1/logic.reflect@1",
  "arguments": {
    "entity": "Acme Corp"
  }
}

Response:

{
  "entity": "Acme Corp",
  "fact_count": 2,
  "facts": [
    { "handle": "fact_a1", "attribute": "billing_contact", "value": "jane@acme.com" },
    { "handle": "fact_a2", "attribute": "plan", "value": "enterprise" }
  ],
  "constraints_applied": 1,
  "tags": ["contacts"]
}

Typical usage

Logic tools are useful for maintaining state across conversations and workflows:

  1. Remember context an agent learns during a session (customer preferences, previous decisions)
  2. Constrain what future workflows can do based on business rules
  3. Query stored knowledge instantly when making decisions
  4. Forget outdated facts when information changes
  5. Reflect to audit what the system knows before taking action