mcpField
D
Decompose

Decompose

ローカル
github.com/echology-ioAI・エージェント1032 週間前に更新

Decompose について

Decomposeは、AIエージェント向けの決定論的なテキスト分類ツールです。LLMではなく正規表現とヒューリスティックを使い、文章を権限、リスク、注意度付きの意味単位に分割します。

主な機能

  1. 01意味単位への分割と分類
  2. 02権限、リスク、種類のラベル付け
  3. 03規格や規制関連エンティティの抽出
  4. 04注意度と実行可能性の評価
  5. 05LLM向け重要テキストの絞り込み

活用シーン

  1. 01契約書や技術仕様書の前処理
  2. 02安全関連と財務関連の内容の振り分け
  3. 03LLMに渡すテキスト量の削減

MCP 対応

MCPサーバーは、テキストの分類やURLの取得・分類に使う`decompose_text`と`decompose_url`ツールを提供します。

設定

ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。

mcp.json · 共通設定
{
"mcpServers": {
"echology-io-decompose": {
"command": "uvx",
"args": [
"decompose-mcp"
]
}
}
}
起動コマンドuvx decompose-mcp

ローカルサーバーにはマシン上の実行環境(Node.js 18 以上など)が必要です。設定ファイルの場所はクライアントごとに異なります。

パッケージ
pypidecompose-mcp0.1.1

ツール

ツール一覧はまだ取得されていません

ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。

詳細

Decompose

CI PyPI Python

プロンプトをやめて、分解を始めましょう。

AI エージェント向けの決定論的なテキスト分類です。Decompose はあらゆるテキストを、分類済みの構造化された意味単位へ瞬時に変換します。LLM もセットアップも不要です。関数を一度呼び出すだけです。


使用前:エージェントが読む内容
The contractor shall provide all materials per ASTM C150-20. Maximum load
shall not exceed 500 psf per ASCE 7-22. Notice to proceed within 14 calendar
days of contract execution. Retainage of 10% applies to all payments.
For general background, the project is located in Denver, CO...
使用後:エージェントが読む内容
[
  {
    "text": "The contractor shall provide all materials per ASTM C150-20.",
    "authority": "mandatory",
    "risk": "compliance",
    "type": "requirement",
    "irreducible": true,
    "attention": 8.0,
    "entities": ["ASTM C150-20"]
  },
  {
    "text": "Maximum load shall not exceed 500 psf per ASCE 7-22.",
    "authority": "prohibitive",
    "risk": "safety_critical",
    "type": "constraint",
    "irreducible": true,
    "attention": 10.0,
    "entities": ["ASCE 7-22"]
  }
]

すべての単位を分類し、すべての規格を抽出し、すべてのリスクを評価します。エージェントは何が重要かを把握できます。


インストール

pip install decompose-mcp

MCP サーバーとして使用する

エージェントの MCP 設定(Claude Code、Cursor、Windsurf など)に追加します。

{
  "mcpServers": {
    "decompose": {
      "command": "uvx",
      "args": ["decompose-mcp", "--serve"]
    }
  }
}

エージェントは次の 2 つのツールを利用できます。

  • decompose_text — 任意のテキストを分解します
  • decompose_url — URL の内容を取得して分解します
OpenClaw

ClawHub からスキルをインストールするか、直接設定します。

{
  "mcpServers": {
    "decompose": {
      "command": "python3",
      "args": ["-m", "decompose", "--serve"]
    }
  }
}

または、スキルをインストールします:clawdhub install decompose-mcp

CLI として使用する

# Pipe text
cat spec.txt | decompose --pretty

# Inline
decompose --text "The contractor shall provide all materials per ASTM C150-20."

# Compact output (smaller JSON)
cat document.md | decompose --compact

ライブラリとして使用する

from decompose import decompose_text, filter_for_llm

result = decompose_text("The contractor shall provide all materials per ASTM C150-20.")

for unit in result["units"]:
    print(f"[{unit['authority']}] [{unit['risk']}] {unit['text'][:60]}...")

# Pre-filter for LLM context — keep only high-value units
filtered = filter_for_llm(result, max_tokens=4000)
print(f"{filtered['meta']['reduction_pct']}% token reduction")
llm_input = filtered["text"]  # Ready for your LLM

各フィールドの意味

フィールド値エージェントに伝える内容
authoritymandatory, prohibitive, directive, permissive, conditional, informational厳格な要件ですか、それとも背景情報ですか?
risksafety_critical, security, compliance, financial, contractual, advisory, informationalどれほど重要ですか?
typerequirement, definition, reference, constraint, narrative, dataどのような種類の内容ですか?
irreducibletrue/false逐語的に保持する必要がありますか?
attention0.0 - 10.0エージェントはここにどれだけの計算リソースを割くべきですか?
entitiesstandards, codes, regulationsどの正式な参照情報が引用されていますか?
actionabletrue/false誰かが何かをする必要がありますか?

これを使って構築できるもの

Decompose は最終目的ではありません。多くの開発者が見過ごしている、LLM の前に行うべきステップです。それが難しいからではなく、その存在を誰も教えてくれなかったからです。ドキュメントには構造があります。その構造は分類できます。そして、推論の前に分類を行うべきです。

Without:  document → chunk → embed → retrieve → LLM → answer  (100% of tokens)
With:     document → decompose → filter/route → LLM → answer  (20-40% of tokens)
フィルター:組み込みの LLM 用事前フィルター

filter_for_llm() は、必須、安全性に関わる重大事項、財務、コンプライアンスに関する単位を保持し、LLM やベクトルストアに届く前に定型文を除外します。

from decompose import decompose_text, filter_for_llm

result = decompose_text(open("contract.md").read())
filtered = filter_for_llm(result, max_tokens=4000)

# filtered["text"] = high-value units only, ready for LLM
# filtered["meta"]["reduction_pct"] = how much was dropped (typically 60-80%)

# Or use the units directly for embedding
for unit in filtered["units"]:
    embed_and_store(unit["text"], metadata={
        "authority": unit["authority"],
        "risk": unit["risk"],
        "attention": unit["attention"],
    })
ルーティング:リスクベースの処理

安全性に関わる重大なコンテンツは 1 つのチェーンに、財務コンテンツは別のチェーンに送ります。定型文はスキップします。

from decompose import decompose_text

result = decompose_text(spec_text)

for unit in result["units"]:
    if unit["risk"] == "safety_critical":
        safety_chain.process(unit)       # Full analysis + human review
    elif unit["risk"] == "financial":
        audit_chain.process(unit)         # Flag for finance team
    elif unit["attention"] < 0.5:
        pass                              # Skip boilerplate
    else:
        general_chain.process(unit)       # Standard LLM analysis
測定:トークンコストの削減
from decompose import decompose_text

result = decompose_text(spec_text)
total = len(result["units"])
high = [u for u in result["units"] if u["attention"] >= 1.0]

print(f"{len(high)}/{total} units need LLM analysis")
print(f"{100 - len(high) * 100 // total}% token reduction")

実行可能なスクリプトについては、examples/ をご覧ください。


Echology による開発

Decompose は Echology が開発し、建築、エンジニアリング、建設企業向けのドキュメントインテリジェンスプラットフォーム AECai から切り出されました。分類パターン、エンティティ抽出、不可分性の検出は、仕様書、契約書、RFI、検査報告書、出来高請求書など、数千件に及ぶ実際の AEC 文書で実証されています。

Decompose は独立したプロジェクトとして十分な実績を築きました。AECai のテキスト分類モジュールとして始まり、保険、トレーディング、規制など複数の分野で利用できる汎用性を証明した後、単独のプロジェクトとして公開されました。無料で、MIT ライセンスです。

ケーススタディ:Open Scripture Intelligence

エンジニアリング仕様を分類するのと同じチャンク分割とエンティティ抽出のパターンで、聖書も構造化できます。Open Scripture Intelligence は、Decompose の Markdown 対応チャンク分割機能と正規表現によるエンティティ抽出を使用して、31,100 節を、344,799 件の相互参照エッジと意味埋め込みを含むナレッジグラフに変換します。これにより、この手法が特定の分野に依存しないことが証明されています。

ブログ

ライセンス: MIT — Copyright (c) 2025-2026 Echology, Inc.

コメント

MCP は初めてですか?

プロトコルの概要から最初のサーバーの導入まで、よくある疑問にまとめて答えます。

AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。