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.1.tar.gz (49.6 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.1-py3-none-any.whl (58.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: py_dianoia-0.2.1.tar.gz
  • Upload date:
  • Size: 49.6 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.1.tar.gz
Algorithm Hash digest
SHA256 eb3cecdc641fb4acb753df6f3c45340adc457d47f527bde4903507fdefc827fb
MD5 f47885b88d0683b662c5525a0963f164
BLAKE2b-256 5d653f3fc4e9e6adf7c96758b8ece89b296d2f7c71e964c8682169e4fe5a8f1b

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_dianoia-0.2.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: py_dianoia-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 58.8 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 908e51279dfd73ba913faa445b76b585782af82137ddf7c8c05b76a7464a8fac
MD5 c9b5402ef30b3c7a45d7e307eafdb110
BLAKE2b-256 11e3cc3bf52460594838e2ffc34f6c81933acae9b2f47261ae6a14f20e82d367

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_dianoia-0.2.1-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