{"id":50410916,"url":"https://github.com/bigmoon-dev/dianoia-ai","last_synced_at":"2026-05-31T03:30:54.513Z","repository":{"id":355428734,"uuid":"1228056181","full_name":"bigmoon-dev/dianoia-ai","owner":"bigmoon-dev","description":"Distill expert reasoning from corpus into profile.yaml and SKILL.md — inject distilled knowledge into any AI model","archived":false,"fork":false,"pushed_at":"2026-05-18T03:27:23.000Z","size":342,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-18T05:35:31.006Z","etag":null,"topics":["agent","agent-skills","ai","cli","code-review","distillation","expert-system","knowledge-distillation","llm","prompt-engineering","skill-extraction"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bigmoon-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-03T14:35:54.000Z","updated_at":"2026-05-18T03:22:26.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/bigmoon-dev/dianoia-ai","commit_stats":null,"previous_names":["bigmoon-dev/dianoia-ai"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bigmoon-dev/dianoia-ai","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmoon-dev%2Fdianoia-ai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmoon-dev%2Fdianoia-ai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmoon-dev%2Fdianoia-ai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmoon-dev%2Fdianoia-ai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bigmoon-dev","download_url":"https://codeload.github.com/bigmoon-dev/dianoia-ai/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmoon-dev%2Fdianoia-ai/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33718446,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-31T02:00:06.040Z","response_time":95,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","agent-skills","ai","cli","code-review","distillation","expert-system","knowledge-distillation","llm","prompt-engineering","skill-extraction"],"created_at":"2026-05-31T03:30:53.801Z","updated_at":"2026-05-31T03:30:54.506Z","avatar_url":"https://github.com/bigmoon-dev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dianoia AI 格物致知\n\n![CI](https://github.com/bigmoon-dev/dianoia-ai/actions/workflows/ci.yml/badge.svg?v=2)\n![Coverage](https://img.shields.io/badge/coverage-77%25-yellowgreen?v=3)\n![PyPI](https://img.shields.io/pypi/v/py-dianoia?color=blue\u0026v=2)\n![Python](https://img.shields.io/pypi/pyversions/py-dianoia?color=blue\u0026v=2)\n![Issues](https://img.shields.io/github/issues/bigmoon-dev/dianoia-ai)\n![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?v=2)\n![Downloads](https://img.shields.io/pypi/dm/py-dianoia?v=2)\n\n\u003e Open-source expert reasoning framework distillation tool\n\n[English](#english) | [中文](./README.zh-CN.md)\n\n---\n\n\u003ca id=\"english\"\u003e\u003c/a\u003e\n\n## What is Dianoia?\n\nDianoia (格物致知) 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.\n\nUnlike knowledge extraction, Dianoia captures **how experts think**: how they define problems, judge quality, prioritize trade-offs, and decide when \"good enough\" is acceptable.\n\nInspired by [The Relic Condition](https://arxiv.org/abs/2604.16116) research on reasoning architecture extraction.\n\n## Install\n\n```bash\npip install py-dianoia\n```\n\nRequires Python 3.11+\n\n## Quick Start\n\n```bash\n# 1. Initialize a project\ndianoia init my-expert\n\n# 2. Add corpus files to my-expert/corpus/\ncp ~/expert-docs/*.md my-expert/corpus/\n\n# 3. Extract reasoning patterns\ndianoia extract my-expert\n\n# 4. Build output files (profile.yaml + SKILL.md)\ndianoia build my-expert\n\n# 5. Validate outputs\ndianoia validate my-expert\n```\n\n## V2 Features\n\n### Interactive TUI for Expert Reasoning\n\n**`dianoia tui init`** — First-run setup wizard to configure your LLM provider, model, API key, and expert directory. Saves to `~/.config/dianoia/config.yaml`.\n\n**`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.\n\n### Interactive Model Switching\n\nSwitch providers and models mid-session with `/model`. Supports 11 providers across international and China markets.\n\n### File Reading and Modification\n\nMention 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.\n\n### Agent Skills Integration\n\nDianoia ships its own `SKILL.md` in the project root. Drop it into your AI coding agent's skills directory once, then agents automatically load dianoia know-how on demand — no need to read docs.\n\n**Install (pip users):**\n\n```bash\n# Download from GitHub\nmkdir -p ~/.claude/skills/dianoia-ai\ncurl -o ~/.claude/skills/dianoia-ai/SKILL.md \\\n  https://raw.githubusercontent.com/bigmoon-dev/dianoia-ai/main/SKILL.md\n\n# Or for other agents:\n# OpenCode:  ~/.config/opencode/skills/dianoia-ai/SKILL.md\n# Claude Code: ~/.claude/skills/dianoia-ai/SKILL.md\n# Codex CLI:   ~/.agents/skills/dianoia-ai/SKILL.md\n```\n\n**How it works:**\n\n| Step | What you say | What happens |\n|------|-------------|--------------|\n| 1. Deploy | (one-time file copy above) | Agent discovers the skill |\n| 2. Distill | \"帮我蒸馏一个 AI 架构师专家\" | Agent runs `dianoia init → extract → build` |\n| 3. Trigger | \"去问问 AI 架构师专家这个怎么设计\" | Agent loads skill → runs `dianoia tui --profile ...` |\n\nTrigger keywords the agent watches for: `dianoia`, `格物致知`, `蒸馏专家`, `蒸馏推理`, `dianoia init`, `dianoia tui`.\n\n### Supported Providers\n\n| Provider | Models | Env Var |\n|----------|--------|---------|\n| OpenAI | gpt-4o, o3, o4-mini | `OPENAI_API_KEY` |\n| Anthropic | Claude Sonnet 4, Opus 4 | `ANTHROPIC_API_KEY` |\n| Google | Gemini 2.5 Pro | `GOOGLE_API_KEY` |\n| Groq | llama, mixtral | `GROQ_API_KEY` |\n| Mistral | mistral-large, mistral-medium | `MISTRAL_API_KEY` |\n| xAI | grok | `XAI_API_KEY` |\n| Together AI | open-source models | `TOGETHER_API_KEY` |\n| DeepSeek | deepseek-chat, deepseek-reasoner | `DEEPSEEK_API_KEY` |\n| Zhipu/智谱 | glm-4-flash, glm-5.1 | `ZHIPU_API_KEY` |\n| Moonshot/月之暗面 | moonshot-v1, kimi-k2 | `MOONSHOT_API_KEY` |\n| Alibaba Qwen/阿里百炼 | qwen-turbo, qwen-plus, qwen-max | `DASHSCOPE_API_KEY` |\n\n## V2 TUI Quick Start\n\n```bash\n# First time setup — configure provider, model, API key, experts directory\ndianoia tui init\n\n# Distill an expert (existing CLI workflow)\ndianoia init my-expert\ncp ~/docs/*.md my-expert/corpus/\ndianoia extract my-expert\ndianoia build my-expert\n\n# Chat with your distilled expert\ndianoia tui\n```\n\n## Architecture\n\n```\nCorpus Files → ExtractionPipeline (8 layers) → IR → ProfileMapper → profile.yaml\n                                                      → SkillRenderer  → SKILL.md\n```\n\n### Feishu (Lark) Bot Integration\n\nChat with distilled experts directly in Feishu. Uses WebSocket long connection — no public URL or webhook setup needed.\n\n```bash\npip install -e \".[feishu]\"\n\n# Configure credentials\ncat \u003e .env \u003c\u003c 'EOF'\nFEISHU_APP_ID=cli_xxxxx\nFEISHU_APP_SECRET=your_secret\nFEISHU_EXPERTS_DIR=~/dianoia-experts\nEOF\n\n# Start the bot\npython -c \"from py_dianoia.integrations.feishu.bot import run; run()\"\n```\n\n**Architecture:** 4-module design reviewed by ai-product-architect expert:\n\n| Module | Responsibility |\n|--------|---------------|\n| `state.py` | SessionStore (TTL expiry) + Deduplicator (LRU) with thread safety |\n| `expert_client.py` | Safe dianoia CLI wrapper (input validation, circuit breaker, timeout) |\n| `router.py` | Rule-based intent routing (list/select/chat), zero SDK dependency |\n| `bot.py` | FeishuAdapter: WebSocket events → router → expert calls via thread pool |\n\n**User commands in Feishu:**\n\n| Command | Action |\n|---------|--------|\n| `列表` | List available experts with descriptions |\n| `expert-name` | Select an expert (e.g. `ai-product-architect`) |\n| Any text | Chat with selected expert |\n| `切换 expert-name` | Switch to another expert |\n\n### 8-Layer Extraction Method\n\n| # | Layer | Extracts |\n|---|-------|----------|\n| 1 | Ontological | Problem boundaries, classification systems |\n| 2 | Teleological | Goals, purposes, end-driven reasoning |\n| 3 | Methodological | Procedures, systematic approaches |\n| 4 | Axiological | Values, priorities, decision criteria |\n| 5 | Epistemological | Knowledge sources, evidence standards |\n| 6 | Conditional | Context-dependent decisions |\n| 7 | Priority | Trade-off ordering (engineering-specific) |\n| 8 | Pragmatic | \"Good enough\" thresholds, practical shortcuts |\n\n### Stability Filtering\n\nFeatures only survive if they appear in ≥2 independent texts AND ≥3 distinct contexts. This filters noise and ensures distilled patterns represent genuine expert consensus.\n\n## Output Formats\n\n### profile.yaml\n\nStructured data for workflow engines (e.g., kitchen-ent):\n\n```yaml\nversion: \"1.0\"\nsections:\n  identity:\n    - key: domain\n      value: engineering\n      confidence: 0.85\n      sources: [doc1.md, doc2.md]\n```\n\n### SKILL.md\n\nFollows the [Agent Skills](https://agentskills.io) open standard:\n\n```markdown\n---\nname: \"my-expert\"\ndescription: \"Expert reasoning distilled from ...\"\n---\n\n# My Expert\n\n## Extracted Reasoning Patterns\n...\n```\n\n## Language Overlay\n\nDistill once in a language-agnostic base profile, then overlay language-specific customizations:\n\n```\nbase-profile.yaml (language-agnostic skeleton)\n  + overlay-python.yaml\n  + overlay-rust.yaml\n  + overlay-go.yaml\n```\n\n## Documentation\n\n- [Distillation Principle](docs/distillation-principle.md)\n- [Architecture](docs/architecture.md)\n- [CLI Reference](docs/cli-reference.md)\n- [Language Overlay](docs/language-overlay.md)\n- [Profile Deliverable](docs/profile-deliverable.md)\n- [SKILL Deliverable](docs/skill-deliverable.md)\n- [Contributing](docs/contributing.md)\n\n## Specifications\n\n- [IR Schema](spec/ir-schema.json) — JSON Schema for the Intermediate Representation\n- [Profile Spec](spec/profile-spec.yaml) — profile.yaml format specification\n- [SKILL Spec](spec/skill-spec.md) — SKILL.md format specification\n\n## Development\n\n```bash\ngit clone https://github.com/bigmoon-dev/dianoia-ai.git\ncd dianoia-ai\npip install -e \".[dev]\"\npytest\n```\n\n## License\n\nApache-2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigmoon-dev%2Fdianoia-ai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbigmoon-dev%2Fdianoia-ai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigmoon-dev%2Fdianoia-ai/lists"}