Skip to main content

Open-source expert reasoning framework distillation tool

Project description

Dianoia AI 格物致知

CI Coverage PyPI Python Issues License Downloads

Open-source expert reasoning framework distillation tool

English | 中文


What is Dianoia?

Dianoia (格物致知) distills expert reasoning patterns from public artifacts — documents, code reviews, design docs — into profile.yaml and SKILL.md formats that any AI agent can consume.

Unlike knowledge extraction, Dianoia captures how experts think: how they define problems, judge quality, prioritize trade-offs, and decide when "good enough" is acceptable.

Inspired by The Relic Condition research on reasoning architecture extraction.

Install

pip install py-dianoia

Requires Python 3.11+

Quick Start

# 1. Initialize a project
dianoia init my-expert

# 2. Add corpus files to my-expert/corpus/
cp ~/expert-docs/*.md my-expert/corpus/

# 3. Extract reasoning patterns
dianoia extract my-expert

# 4. Build output files (profile.yaml + SKILL.md)
dianoia build my-expert

# 5. Validate outputs
dianoia validate my-expert

V2 Features

Interactive TUI for Expert Reasoning

dianoia tui init — First-run setup wizard to configure your LLM provider, model, API key, and expert directory. Saves to ~/.config/dianoia/config.yaml.

dianoia tui — Launch an interactive terminal session to reason with a distilled expert. Select an expert from your configured experts directory and start a phase-guided reasoning conversation.

Interactive Model Switching

Switch providers and models mid-session with /model. Supports 11 providers across international and China markets.

File Reading and Modification

Mention a file path in chat and the expert auto-reads it. After discussion, use /apply to let the expert write changes back — with preview, confirmation, and automatic .bak backup.

Supported Providers

Provider Models Env Var
OpenAI gpt-4o, o3, o4-mini OPENAI_API_KEY
Anthropic Claude Sonnet 4, Opus 4 ANTHROPIC_API_KEY
Google Gemini 2.5 Pro GOOGLE_API_KEY
Groq llama, mixtral GROQ_API_KEY
Mistral mistral-large, mistral-medium MISTRAL_API_KEY
xAI grok XAI_API_KEY
Together AI open-source models TOGETHER_API_KEY
DeepSeek deepseek-chat, deepseek-reasoner DEEPSEEK_API_KEY
Zhipu/智谱 glm-4-flash, glm-5.1 ZHIPU_API_KEY
Moonshot/月之暗面 moonshot-v1, kimi-k2 MOONSHOT_API_KEY
Alibaba Qwen/阿里百炼 qwen-turbo, qwen-plus, qwen-max DASHSCOPE_API_KEY

V2 TUI Quick Start

# First time setup — configure provider, model, API key, experts directory
dianoia tui init

# Distill an expert (existing CLI workflow)
dianoia init my-expert
cp ~/docs/*.md my-expert/corpus/
dianoia extract my-expert
dianoia build my-expert

# Chat with your distilled expert
dianoia tui

Architecture

Corpus Files → ExtractionPipeline (8 layers) → IR → ProfileMapper → profile.yaml
                                                     → SkillRenderer  → SKILL.md

8-Layer Extraction Method

# Layer Extracts
1 Ontological Problem boundaries, classification systems
2 Teleological Goals, purposes, end-driven reasoning
3 Methodological Procedures, systematic approaches
4 Axiological Values, priorities, decision criteria
5 Epistemological Knowledge sources, evidence standards
6 Conditional Context-dependent decisions
7 Priority Trade-off ordering (engineering-specific)
8 Pragmatic "Good enough" thresholds, practical shortcuts

Stability Filtering

Features only survive if they appear in ≥2 independent texts AND ≥3 distinct contexts. This filters noise and ensures distilled patterns represent genuine expert consensus.

Output Formats

profile.yaml

Structured data for workflow engines (e.g., kitchen-ent):

version: "1.0"
sections:
  identity:
    - key: domain
      value: engineering
      confidence: 0.85
      sources: [doc1.md, doc2.md]

SKILL.md

Follows the Agent Skills open standard:

---
name: "my-expert"
description: "Expert reasoning distilled from ..."
---

# My Expert

## Extracted Reasoning Patterns
...

Language Overlay

Distill once in a language-agnostic base profile, then overlay language-specific customizations:

base-profile.yaml (language-agnostic skeleton)
  + overlay-python.yaml
  + overlay-rust.yaml
  + overlay-go.yaml

Documentation

Specifications

  • IR Schema — JSON Schema for the Intermediate Representation
  • Profile Spec — profile.yaml format specification
  • SKILL Spec — SKILL.md format specification

Development

git clone https://github.com/bigmoon-dev/dianoia-ai.git
cd dianoia-ai
pip install -e ".[dev]"
pytest

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_dianoia-0.2.2.tar.gz (50.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_dianoia-0.2.2-py3-none-any.whl (59.4 kB view details)

Uploaded Python 3

File details

Details for the file py_dianoia-0.2.2.tar.gz.

File metadata

  • Download URL: py_dianoia-0.2.2.tar.gz
  • Upload date:
  • Size: 50.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for py_dianoia-0.2.2.tar.gz
Algorithm Hash digest
SHA256 5f0f0c26b1b3c0daedcb06d0efbaa826cd06e23266e99fb15cfbe61826e9dbc5
MD5 a66dca539e5e1a8fa44d0797041e0471
BLAKE2b-256 005fd3a39e49d0ff861276223242afd3af70c11011bcec4697b6c4f731e4ea8e

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_dianoia-0.2.2.tar.gz:

Publisher: ci.yml on bigmoon-dev/dianoia-ai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file py_dianoia-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: py_dianoia-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 59.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for py_dianoia-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7ab4ca4f3655275323dbabec5a5e272ea1ef8535d90162c7bce2703c1a3d197b
MD5 954e829f67efafbb94a40763ce04305e
BLAKE2b-256 0952790eeede9aa0d7bef449e89ff1613cdd659830a29abbb441609621cc999a

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_dianoia-0.2.2-py3-none-any.whl:

Publisher: ci.yml on bigmoon-dev/dianoia-ai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page