Skip to content
Back to skills

Logic Query

ASecurity

Query symbolic knowledge bases using natural language or formal logic syntax.

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added February 7, 2026
ai-agentsgo

Works with

  • cli
  • mcp

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add NewJerseyStyle/plugin-logic-llm --skill logic-query --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Logic Query?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Logic Query
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/newjerseystyle-logic-query/badge)](https://www.skillsdirectory.com/skills/newjerseystyle-logic-query)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# /logic-query

Query symbolic knowledge bases using natural language or formal logic syntax.

## Description

This skill enables querying knowledge bases that have been created through `/logic-convert` or manually. It translates natural language questions into formal queries and returns human-readable answers using the appropriate solver.

## Supported Solvers

| Solver | MCP Server | Query Types |
|--------|------------|-------------|
| Prolog | prolog-mcp | Yes/no, find values, find all |
| Clingo | clingo-mcp | Answer sets, optimization |
| Z3 | z3smt-mcp | Satisfiability, models, proofs |
| FOL | folprover-mcp | Theorem proving |
| Pyke | pyke-mcp | Goal proving, variable bindings |

## Usage

```
/logic-query [options] <question>
```

### Options

- `--format <prolog|clingo|z3|fol|pyke>` - Query format (auto-detected if KB loaded)
- `--kb <path>` - Path to knowledge base file(s) to load
- `--session <name>` - Use named session (persists loaded facts/rules)
- `--explain` - Show reasoning trace/proof
- `--all` - Return all solutions/answer sets/models
- `--timeout <ms>` - Query timeout in milliseconds

### Examples

```
/logic-query "Is John allowed to access the confidential files?"
/logic-query --kb ./legal/rules.pl --explain "Can contractors view salary data?"
/logic-query --format clingo --all "What are the valid schedules?"
/logic-query --format z3 "Is it possible to assign all tasks within budget?"
/logic-query --format fol --explain "Does mortality follow from the premises?"
/logic-query --format pyke --session hr "Who reports to the CEO?"
```

## Query Types by Solver

### Prolog Queries
```
# Yes/No
?- can_access(john, file_a).

# Find values
?- can_access(john, What).

# Find all
?- findall(X, can_access(X, confidential), People).
```

### Clingo Queries
```
# Check satisfiability (answer sets exist?)
# Find all answer sets
# Optimization (minimize/maximize)
```

### Z3 Queries
```
# Satisfiability check
s.check()

# Get model
s.model()

# Prove theorem
prove(theorem)
```

### FOL Queries
```
# Prove from premises
prove(premises, conclusion)

# Check validity
```

### Pyke Queries
```
# Test fact
query("Mortal(socrates, True)")

# Find bindings
prove_goal("Descendant(tom, $who, True)")
```

## Behavior

1. **Session Management**: Load or create query session
2. **Knowledge Base Loading**: Load specified KB files if not in session
3. **Query Translation**: Convert natural language to formal query
4. **Registry Lookup**: Use registry to resolve predicate names
5. **Solver Selection**: Choose appropriate solver based on format
6. **Execution**: Run query through MCP server
7. **Result Interpretation**: Translate formal results to natural language

## Output

The skill returns:
- Answer to the query (yes/no, values, or explanations)
- Reasoning trace if `--explain` is used
- Multiple solutions if `--all` is specified
- Confidence indicator when translation is ambiguous

## Session Persistence

Sessions are stored in `data/sessions/` and can be resumed across conversations:
- Use `--session myproject` to name a session
- Sessions preserve loaded facts, rules, and query history
- Sessions support incremental knowledge base updates
- Each solver has its own session namespace

## Integration

This skill uses:
- `prolog-mcp`: runPrologQuery, loadProgram
- `clingo-mcp`: solve, getProgram
- `z3smt-mcp`: check_sat, solve, prove
- `folprover-mcp`: prove, add_premise
- `pyke-mcp`: query, prove_goal
- `logic-registry` for predicate resolution

## Notes

- Natural language queries are mapped to formal queries using the registry's predicate descriptions
- Complex queries may be decomposed into sub-queries for better accuracy
- The skill handles negation appropriately for each solver type
- Timeout helps prevent long-running queries from blocking

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.