Logic Ingest
npx machina-cli add skill NewJerseyStyle/plugin-logic-llm/logic-ingest --openclaw/logic-ingest
Batch ingest documents into the symbolic knowledge base with automatic incremental updates.
Description
This skill processes entire directories of documents, converting them to logic programs and maintaining a coherent, non-redundant knowledge base. It handles incremental updates when new documents are added.
Usage
/logic-ingest [options] <source-directory>
Options
--format <prolog|clingo>- Target format (default: prolog)--output <directory>- Output directory for generated logic programs--domain <name>- Domain name for organizing the knowledge base--watch- Watch for new files and auto-ingest--incremental- Only process new or modified files--merge- Merge all outputs into a single knowledge base file
Examples
/logic-ingest --format prolog --domain legal ./contracts/
/logic-ingest --incremental --watch ./regulations/
/logic-ingest --merge --output ./kb/ ./policies/
Behavior
- Directory Scan: Identify all processable documents
- Change Detection: Compare with previous ingestion state
- Dependency Analysis: Determine processing order based on references
- Batch Conversion: Convert documents using
/logic-convert - Deduplication: Remove redundant predicates and rules
- Consistency Check: Validate the combined knowledge base
- Registry Update: Update registry with all new entries
Document Types Supported
- Plain text (.txt)
- Markdown (.md)
- PDF (requires external tool)
- Legal documents (contracts, regulations, policies)
- Structured data (JSON, YAML) with schema inference
Incremental Updates
When --incremental is used:
- Only new or modified files are processed
- Existing predicates are preserved
- Conflicts are detected and reported
- Registry is updated atomically
Output Structure
output/
├── predicates.pl # All predicate definitions
├── facts/
│ ├── document1.pl # Facts from each document
│ └── document2.pl
├── rules/
│ ├── inferred.pl # Derived rules
│ └── explicit.pl # Explicit rules from documents
├── registry.json # Local registry snapshot
└── manifest.json # Ingestion metadata
Integration
This skill orchestrates:
/logic-convertfor individual document conversion/logic-registerfor predicate registrationprolog-mcporclingo-mcpfor validation
Notes
- Large document sets are processed in parallel where possible
- The manifest tracks file hashes for efficient incremental updates
- Use
--mergefor smaller knowledge bases that benefit from single-file loading - The skill handles cross-document references through the registry
Source
git clone https://github.com/NewJerseyStyle/plugin-logic-llm/blob/main/skills/logic-ingest/SKILL.mdView on GitHub Overview
Logic Ingest batch-processes documents from a directory, converting them into logic programs and storing them in a coherent, non-redundant symbolic knowledge base. It supports automatic incremental updates so that new or modified files update the KB without reprocessing the entire corpus. Outputs are organized into predicates, facts, rules, and a local registry for reliable cross-document references.
How This Skill Works
The skill scans a source directory for processable documents, detects changes since the last ingest, and determines processing order via dependencies. It uses /logic-convert to transform documents into logic programs, then deduplicates and validates the combined knowledge base before updating the registry. With incremental mode, it preserves existing predicates and applies atomic updates to the registry.
When to Use It
- You have a directory of contracts, regulations, or policies that should be transformed into a logic knowledge base.
- You want automatic incremental updates when new documents are added or existing ones change.
- You need to generate a single knowledge base file or maintain a multi-file output structure for scalability.
- You want to watch a directory and ingest new content in real time.
- You need domain organization to group KB assets under a specific domain name.
Quick Start
- Step 1: Run /logic-ingest [options] <source-directory> to ingest a batch of documents.
- Step 2: If updates will come in over time, enable --watch and/or --incremental to update only new or changed files.
- Step 3: Check output/predicates.pl, output/facts, output/rules, and registry.json to confirm ingestion and consistency.
Best Practices
- Use --incremental for large document sets to preserve existing predicates and minimize reprocessing.
- Enable --watch to automatically ingest new or updated documents as they appear.
- Specify --domain to organize the KB and --output to control the generated file location.
- Run consistency checks and rely on the manifest and registry for accurate state tracking.
- If the KB is small, consider --merge to load as a single file; for larger KBs, keep separate predicates, facts, and rules.
Example Use Cases
- /logic-ingest --format prolog --domain legal ./contracts/
- /logic-ingest --incremental --watch ./regulations/
- /logic-ingest --merge --output ./kb/ ./policies/
- /logic-ingest --format clingo --domain standards ./compliance/
- /logic-ingest --incremental --watch --merge ./kb/ ./policies/