Framework-level document ingestion primitives for Muscles
Project description
muscles-documents
Framework-level document ingestion and chunking package for the Muscles ecosystem.
Purpose
- Define contracts for documents, chunking, parsing and metadata.
- Provide an initial pipeline for local files + markdown/text content ingestion.
- Expose
Musclesactions to drive ingestion/diagnostics through any transport.
Ecosystem Position
muscles-documents is a framework extension for document flows. It owns source
loading, parsing, chunking, metadata and sync planning; it does not own AI model
calls or protocol routing.
Related repositories:
muscles- core action contracts, dispatcher, inspect contract and canonical documentation.muscles-ai- AI/RAG actions that can consume document contracts.muscles-sql- SQL persistence for projects that store document metadata or ingestion state.muscles-mcp- MCP projection for document actions when exposed to AI tools.muscles-benchmarks- regression coverage for document extension contracts.
Installation
pip install git+https://github.com/butkoden/muscles-documents.git
The canonical ecosystem install matrix lives in
muscles/docs/installation.md.
Configured as a standard module package:
modules:
documents:
package: muscles_documents
sources:
docs:
type: local
path: ./docs
Actions
documents.sources.listdocuments.source.inspectdocuments.loaddocuments.parsedocuments.normalizedocuments.chunkdocuments.sync.plandocuments.sync.requestdocuments.inspectdocuments.doctor
Ingestion Toolkit
The package exposes portable contracts for the document preparation flow:
source -> DocumentRef -> DocumentBlob -> ParsedDocument
-> DocumentSection / DocumentBlock -> DocumentChunk
-> DocumentSyncPlan / DocumentSyncResult
MVP components:
- local source adapter with stable relative references;
- raw blob loading with checksums;
- text, markdown and HTML parsers;
- safe text normalizer that preserves markdown code fences;
- fixed-size and heading-aware chunkers;
- dry-run sync planner;
- sync request result contract for project executors/jobs;
- safe
inspectanddoctordiagnostics.
Projects own persistence and integration policy. They may store refs, blobs,
parsed documents, chunks and sync state in PostgreSQL, Elasticsearch, MongoDB,
Redis, Qdrant or another system, but muscles-documents does not import those
clients and does not write to external stores directly.
muscles-ai can consume DocumentChunk objects after a project stores and
exposes them through its own data/search ports. This package does not call
LLMs, create embeddings, rank search results or own prompt/RAG behavior.
Python API
from muscles_documents.config import SourceConfig
from muscles_documents.runtime import DocumentPipeline
pipeline = DocumentPipeline(
key="documents",
sources={
"docs": SourceConfig(name="docs", type="local", path="./docs"),
},
)
refs = pipeline.list_refs("docs")
blob = pipeline.load_blob("docs", refs[0].reference)
parsed = pipeline.parse_blob(blob)
normalized = pipeline.normalize(parsed)
chunks = pipeline.chunk(normalized, strategy="heading")
plan = pipeline.sync_plan("docs")
Scope
MVP is read-only: no writes to external systems are performed. Google Drive, PDF/DOCX, URL/HTTP and richer storage adapters are extension points for later package iterations; the current package keeps parser/source contracts stable for those additions.
Telemetry
muscles-documents resolves telemetry through the neutral Muscles
TelemetryProvider; it does not import muscles-otel directly.
When a project registers a provider, document actions emit safe spans:
muscles.documents.source.listmuscles.documents.loadmuscles.documents.parsemuscles.documents.normalizemuscles.documents.chunkmuscles.documents.sync.planmuscles.documents.sync.executemuscles.documents.inspectmuscles.documents.doctor
Allowed attributes include source name/type, MIME, parser and chunker metadata. Raw document text, HTML body, extracted text, file content, source credentials and tokens must not be stored in span attributes.
Examples
Local source smoke
Run a full documents.* action flow on temporary files:
PYTHONPATH=src python examples/run_documents_pipeline.py
Sync plan and request
Build and inspect a sync plan for configured sources:
PYTHONPATH=src python examples/run_documents_sync.py
Both examples:
- initialize package via
init_package(app, config); - use
ActionDispatcherfor actions; - demonstrate
load,parse,normalize,chunk,sync.plan,sync.request,inspect, anddoctorflows; - show neutral telemetry provider usage without requiring
muscles-otel.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file muscles_documents-0.1.0.tar.gz.
File metadata
- Download URL: muscles_documents-0.1.0.tar.gz
- Upload date:
- Size: 19.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40b7bf6191b2c5d174b822945d09add6690ee9cc3a863fcae0a2dc9026424653
|
|
| MD5 |
cf7b08e46ec651afcf18b3c8442a2b8b
|
|
| BLAKE2b-256 |
2680c1db0a89132069cced25b151f10e8113116eef875e2021479fdf37d19381
|
Provenance
The following attestation bundles were made for muscles_documents-0.1.0.tar.gz:
Publisher:
release.yml on butkoden/muscles-documents
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
muscles_documents-0.1.0.tar.gz -
Subject digest:
40b7bf6191b2c5d174b822945d09add6690ee9cc3a863fcae0a2dc9026424653 - Sigstore transparency entry: 2258919365
- Sigstore integration time:
-
Permalink:
butkoden/muscles-documents@90a07c6a31d8930aa1a1ba5c5ad2b0e157fb1299 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/butkoden
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@90a07c6a31d8930aa1a1ba5c5ad2b0e157fb1299 -
Trigger Event:
release
-
Statement type:
File details
Details for the file muscles_documents-0.1.0-py3-none-any.whl.
File metadata
- Download URL: muscles_documents-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42160686930acd05aca6dbb976f7d5f47d1caaa8a066758350922d7591217203
|
|
| MD5 |
c4d8890c4ec733ac82bc00c0785273f9
|
|
| BLAKE2b-256 |
6d42424f6cdaa15f4ca1934f831ed40c351ed404c68f76ca15233a42b574b6f9
|
Provenance
The following attestation bundles were made for muscles_documents-0.1.0-py3-none-any.whl:
Publisher:
release.yml on butkoden/muscles-documents
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
muscles_documents-0.1.0-py3-none-any.whl -
Subject digest:
42160686930acd05aca6dbb976f7d5f47d1caaa8a066758350922d7591217203 - Sigstore transparency entry: 2258919405
- Sigstore integration time:
-
Permalink:
butkoden/muscles-documents@90a07c6a31d8930aa1a1ba5c5ad2b0e157fb1299 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/butkoden
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@90a07c6a31d8930aa1a1ba5c5ad2b0e157fb1299 -
Trigger Event:
release
-
Statement type: