predicate-skill 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +24 -0
- package/LICENSE +202 -0
- package/README.md +47 -0
- package/cli.bundle.mjs +324 -0
- package/commands/ask.md +18 -0
- package/commands/doctor.md +14 -0
- package/commands/down.md +11 -0
- package/commands/stats.md +22 -0
- package/commands/up.md +13 -0
- package/compose/docker-compose.yml +25 -0
- package/compose/fuseki/config.ttl +18 -0
- package/hooks/hooks.json +9 -0
- package/hooks/session-start.sh +25 -0
- package/package.json +47 -0
- package/server.bundle.mjs +38038 -0
- package/skills/predicate/SKILL.md +119 -0
- package/skills/predicate-doctor/SKILL.md +28 -0
- package/skills/predicate-stats/SKILL.md +29 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
services:
|
|
2
|
+
fuseki:
|
|
3
|
+
image: stain/jena-fuseki:5.0.0
|
|
4
|
+
container_name: predicate-fuseki
|
|
5
|
+
ports:
|
|
6
|
+
- "127.0.0.1:3030:3030"
|
|
7
|
+
environment:
|
|
8
|
+
ADMIN_PASSWORD: ${PREDICATE_ADMIN_PASSWORD:-changeme}
|
|
9
|
+
FUSEKI_BASE: /fuseki
|
|
10
|
+
volumes:
|
|
11
|
+
# Named volume for /fuseki: bind-mounting it makes virtiofs fight
|
|
12
|
+
# nested mounts on macOS Docker Desktop, and Fuseki rejects a
|
|
13
|
+
# read-only configuration dir even with no nested mount.
|
|
14
|
+
- fuseki-data:/fuseki
|
|
15
|
+
# Config lives outside FUSEKI_BASE; we point Fuseki at it via --conf.
|
|
16
|
+
- ./fuseki/config.ttl:/fuseki-config/predicate.ttl:ro
|
|
17
|
+
command: ["/jena-fuseki/fuseki-server", "--conf", "/fuseki-config/predicate.ttl"]
|
|
18
|
+
healthcheck:
|
|
19
|
+
test: ["CMD", "curl", "-fsS", "http://localhost:3030/$$/ping"]
|
|
20
|
+
interval: 5s
|
|
21
|
+
timeout: 3s
|
|
22
|
+
retries: 20
|
|
23
|
+
|
|
24
|
+
volumes:
|
|
25
|
+
fuseki-data:
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
@prefix : <#> .
|
|
2
|
+
@prefix fuseki: <http://jena.apache.org/fuseki#> .
|
|
3
|
+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
4
|
+
@prefix tdb2: <http://jena.apache.org/2016/tdb#> .
|
|
5
|
+
@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
|
|
6
|
+
|
|
7
|
+
:service rdf:type fuseki:Service ;
|
|
8
|
+
fuseki:name "predicate" ;
|
|
9
|
+
fuseki:serviceQuery "query", "sparql" ;
|
|
10
|
+
fuseki:serviceUpdate "update" ;
|
|
11
|
+
fuseki:serviceUpload "upload" ;
|
|
12
|
+
fuseki:serviceReadGraphStore "get" ;
|
|
13
|
+
fuseki:serviceReadWriteGraphStore "data" ;
|
|
14
|
+
fuseki:dataset :dataset .
|
|
15
|
+
|
|
16
|
+
:dataset rdf:type tdb2:DatasetTDB2 ;
|
|
17
|
+
tdb2:location "/fuseki/databases/predicate" ;
|
|
18
|
+
tdb2:unionDefaultGraph true .
|
package/hooks/hooks.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# SessionStart hook: emits a short context block telling the agent
|
|
3
|
+
# how many open goals and active concepts Predicate is tracking.
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
FUSEKI="${FUSEKI_URL:-http://localhost:3030}"
|
|
6
|
+
DS="${PREDICATE_DATASET:-predicate}"
|
|
7
|
+
|
|
8
|
+
if ! curl -fsS "$FUSEKI/$/ping" >/dev/null 2>&1; then
|
|
9
|
+
jq -n '{ additional_context: "Predicate: Fuseki not reachable; KG tools may fail. Start it with `pnpm fuseki:up`." }'
|
|
10
|
+
exit 0
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
GOALS=$(curl -fsS "$FUSEKI/$DS/query" \
|
|
14
|
+
--data-urlencode "query=PREFIX pred: <https://predicate.dev/meta#>
|
|
15
|
+
SELECT (COUNT(*) AS ?n) WHERE { GRAPH <kg:goals> { ?g pred:status \"active\" } }" \
|
|
16
|
+
--header "Accept: application/sparql-results+json" \
|
|
17
|
+
| jq -r '.results.bindings[0].n.value // "0"')
|
|
18
|
+
|
|
19
|
+
CONCEPTS=$(curl -fsS "$FUSEKI/$DS/query" \
|
|
20
|
+
--data-urlencode "query=SELECT (COUNT(DISTINCT ?c) AS ?n) WHERE { GRAPH <kg:tbox> { ?c a <http://www.w3.org/2002/07/owl#Class> } }" \
|
|
21
|
+
--header "Accept: application/sparql-results+json" \
|
|
22
|
+
| jq -r '.results.bindings[0].n.value // "0"')
|
|
23
|
+
|
|
24
|
+
MSG="Predicate ready: ${GOALS} active goals, ${CONCEPTS} TBox classes. Use kg_explore_schema before drafting SPARQL."
|
|
25
|
+
jq -n --arg m "$MSG" '{ additional_context: $m }'
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "predicate-skill",
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "Local reasoning knowledge graph (RDF/OWL) for AI agents — Claude Code plugin + MCP server + predicate CLI.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Nordic Agents Research",
|
|
7
|
+
"email": "midhunxavier@outlook.com"
|
|
8
|
+
},
|
|
9
|
+
"license": "Apache-2.0",
|
|
10
|
+
"homepage": "https://github.com/NordicAgents/predicate#readme",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/NordicAgents/predicate.git",
|
|
14
|
+
"directory": "packages/predicate-skill"
|
|
15
|
+
},
|
|
16
|
+
"bugs": "https://github.com/NordicAgents/predicate/issues",
|
|
17
|
+
"keywords": [
|
|
18
|
+
"mcp", "claude-code", "knowledge-graph", "rdf", "owl",
|
|
19
|
+
"sparql", "reasoning", "fuseki", "agent"
|
|
20
|
+
],
|
|
21
|
+
"type": "module",
|
|
22
|
+
"bin": {
|
|
23
|
+
"predicate": "./cli.bundle.mjs"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"server.bundle.mjs",
|
|
27
|
+
"cli.bundle.mjs",
|
|
28
|
+
".claude-plugin",
|
|
29
|
+
"skills",
|
|
30
|
+
"commands",
|
|
31
|
+
"hooks",
|
|
32
|
+
"compose",
|
|
33
|
+
"LICENSE",
|
|
34
|
+
"README.md"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"bundle": "node scripts/bundle.mjs",
|
|
38
|
+
"prepublishOnly": "node scripts/bundle.mjs && node -e \"const fs=require('fs');for(const f of ['server.bundle.mjs','cli.bundle.mjs']){if(!fs.existsSync(f)){console.error('missing '+f);process.exit(1)}}\""
|
|
39
|
+
},
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=20"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
46
|
+
"private": false
|
|
47
|
+
}
|