pyke
Skill4 starsChanged 9 months agoUnlicenseView on GitHub
Use when building, reviewing, or debugging Pyke (Python Knowledge Engine, scitools-pyke) expert-system / logic-programming code — writing .krb/.kfb/.kqb source files, using the knowledge_engine.engine API, pattern matching, rules, plans, the special knowledge base, or question bases. Triggers on: "Pyke", "scitools-pyke", ".krb", ".kfb", ".kqb", "knowledge_engine", "backward chaining", "expert system", "forward chaining".
In this repository70 other files it gives its agents.
- agent/AGENTS.mdAGENTS.md
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- git-guardrails-claude-codeSkill
- setup-project-skillsSkill
- skill-creatorSkill
- websearchSkill
- writing-great-skillsSkill
- codebase-designSkill
- construction-craftSkill
- critical-partnerSkill
- data-intensiveSkill
- diagnosing-bugsSkill
- django-disciplineSkill
- docker-disciplineSkill
- documentation-lifecycleSkill
- domain-driven-designSkill
- enterprise-patternsSkill
- git-disciplineSkill
- legacy-codeSkill
- production-readinessSkill
- refactoring-passSkill
- resolving-merge-conflictsSkill
- tddSkill
- testing-workflowSkill
- ui-design-directionSkill
- webapp-testingSkill
- django-allauthSkill
- djangoSkill
- dockerSkill
- drfSkill
- full-calendarSkill
- giteaSkill
- htmxSkill
- http-status-codesSkill
- hyperscriptSkill
- langchainSkill
- litestarSkill
- prestashopSkill
- python-asyncSkill
- tablerSkill
- cleanroom-rewriteSkill
- councilSkill
- court-jesterSkill
- domain-modelingSkill
- fix-prSkill
- grillingSkill
- grill-meSkill
- grill-with-docsSkill
- handoffSkill
- humanifySkill
- implementSkill
- implement-specSkill
- improve-codebase-architectureSkill
- ponytail-auditSkill
- ponytail-debtSkill
- prototypeSkill
- qaSkill
- researchSkill
- restore-test-pyramidSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
Use this skill for Pyke work.
- Distinctive: line 23
Read only the reference file(s) needed for the task.
- Very specific: line 77
If a plan is involved, explain how it is produced (with/plan_spec/taking) and how it is called/pickled.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Pyke (Python Knowledge Engine) Reference
Use this skill for Pyke work. Pyke introduces logic programming (inspired by Prolog) to Python via a knowledge-based inference engine written in 100% Python. You write Python functions and Pyke rules that assemble them into customized call graphs ("plans") for specific use cases.
Read only the reference file(s) needed for the task.
Critical Gotchas
- Rule base activation runs forward-chaining rules —
engine.activate()fires all forward-chaining rules in the activated rule bases. Assert your facts before activating, or use universal facts /.kfbfiles loaded at engine creation. reset()erases case-specific facts and deactivates rule bases — callengine.reset()between cases, then re-assert facts and re-activate.- Goals are strings with
$pattern variables — e.g.family.how_related($p1, $p2, $rel). Pattern variables start with$. prove_1_goalreturns(vars, plan)—varsis a dict (without$) of pattern-variable bindings;planis a callable (orNone). Plans can be pickled.prove_goalreturns a context-manager generator — usewithand iterate to get all solutions. Raises no exception when there are no solutions.CanNotProveis raised only byprove_1_goal—prove_goalreturns an empty generator instead.IDENTIFIERin patterns is a literal — to use a variable, write$name.- Duplicate facts are silently ignored — a fact with the same name and arguments cannot be asserted twice.
assert_is case-specific — useadd_universal_factfor persistent facts, or put facts in.kfbfiles.engineconstructor scans recursively —.kfb/.krb/.kqbfiles are found anywhere under the search path; the knowledge-base name is the filename minus its suffix.
Routing
| File | Use for |
references/api-engine.md | knowledge_engine.engine API, lifecycle, asserting facts, proving goals, tracing, stats |
references/rules-syntax.md | .krb syntax: fc_rule, bc_rule, use/when/with/taking, plan_spec, first/forall/notany, compound premises, Python premises |
references/facts-kb.md | facts, fact bases, knowledge bases, special KB, question bases |
references/pyke-syntax.md | KFB/KRB/KQB source-file syntax, lexical rules, data types |
references/pattern-matching.md | pattern syntax, pattern/anonymous/rest variables, matching semantics, context API |
references/using-pyke.md | operational workflow: create engine, assert facts, activate, prove goals, plans, tracing, compiled goals |
references/special-qbase.md | special.claim_goal/check_command/command/general_command, question-base details |
references/examples.md | concrete examples mirroring the shipped examples/ |
references/REFERENCE.md | cross-file routing (this is it) |
When NOT to Use This Skill
- Prolog itself — this skill is Pyke-specific (Python integration).
- Generic rule-engine libraries (e.g.
rules_engine,jsonrules) — only Pyke'sscitools-pykepackage. - Pyke 0.x / legacy 0.6 — the 1.1.1 API differs (e.g.
engineconstructor,prove_goal/prove_1_goal).
Output Expectations
- Name the source file(s) and knowledge-base name(s) used.
- State which rule base must be activated and in what order facts are asserted.
- If a plan is involved, explain how it is produced (
with/plan_spec/taking) and how it is called/pickled. - State the minimum verification: create an engine, activate, and run a
prove_1_goalsmoke test against a tiny.kfb/.krbpair.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

