Docs Acset
by plurigrid
Google Docs/Sheets management via ACSet condensation. Transforms documents into GF(3)-typed Interactions, tracks comments/cells, detects saturation when all comments resolved. Use for document workflows, spreadsheet automation, or applying ANIMA principles to Workspace documents.
Skill Details
Repository Files
1 file in this skill directory
name: docs-acset description: Google Docs/Sheets management via ACSet condensation. Transforms documents into GF(3)-typed Interactions, tracks comments/cells, detects saturation when all comments resolved. Use for document workflows, spreadsheet automation, or applying ANIMA principles to Workspace documents. version: 1.0.0
Docs ACSet Skill
Transform Google Docs/Sheets into an ACSet-condensed system with GF(3) conservation.
Trit: 0 (ERGODIC - coordinator)
Principle: Published Document = Condensed State
Implementation: DocsACSet + CommentTracker + CellSaturation
Overview
Docs ACSet applies category-theoretic structure to documents:
- Transform - Documents/Sheets → GF(3)-typed Interactions
- Track - Comments/Cells → Saturation state
- Detect - All resolved → ANIMA condensed state
- Verify - Narya proofs for consistency
DocsACSet Schema
┌────────────────────────────────────────────────────────────────────┐
│ DocsACSet Schema │
├────────────────────────────────────────────────────────────────────┤
│ │
│ Document ────────┬────▶ Section │
│ ├─ doc_id: String│ ├─ heading: String │
│ ├─ title: String │ ├─ level: Int │
│ └─ published: Bool └─ content_hash: String │
│ │ │
│ Comment ─────────┼────▶ Thread (doc) │
│ ├─ content: String ├─ resolved: Bool │
│ ├─ author: String └─ reply_count: Int │
│ └─ trit: Trit │ │
│ │ │
│ Spreadsheet ─────┼────▶ Sheet │
│ ├─ ss_id: String │ ├─ name: String │
│ └─ locale: String └─ row_count: Int │
│ │ │
│ Cell ────────────┴────▶ Range │
│ ├─ value: String ├─ a1_notation: String │
│ ├─ formula: String └─ dirty: Bool │
│ └─ trit: Trit │
└────────────────────────────────────────────────────────────────────┘
Objects
| Object | Description | Trit Role |
|---|---|---|
Document |
Google Doc with publish state | Aggregate |
Section |
Heading-delimited content block | Node |
Comment |
Review comment with resolution state | Interaction |
Spreadsheet |
Google Sheets workbook | Aggregate |
Sheet |
Individual tab within spreadsheet | Node |
Cell |
Single cell with value/formula | Data |
GF(3) Verb Typing
Docs/Sheets actions assigned trits based on information flow:
VERB_TRIT_MAP = {
# MINUS (-1): Consumption/Reading
"get_doc_content": -1, "read_sheet_values": -1,
"get_spreadsheet_info": -1, "inspect_doc_structure": -1,
"read_document_comments": -1, "debug_table_structure": -1,
# ERGODIC (0): Coordination/Metadata
"modify_doc_text": 0, "find_and_replace_doc": 0,
"update_doc_headers_footers": 0, "resolve_document_comment": 0,
"create_sheet": 0, "reply_to_document_comment": 0,
# PLUS (+1): Generation/Creation
"create_doc": +1, "create_spreadsheet": +1,
"insert_doc_elements": +1, "insert_doc_image": +1,
"create_table_with_data": +1, "modify_sheet_values": +1,
"create_document_comment": +1, "export_doc_to_pdf": +1,
}
MCP Tool → Trit Mapping
| Tool | Trit | Description |
|---|---|---|
get_doc_content |
-1 | Read document (MINUS) |
read_sheet_values |
-1 | Read cells (MINUS) |
read_document_comments |
-1 | Read comments (MINUS) |
modify_doc_text |
0 | Edit text (ERGODIC) |
resolve_document_comment |
0 | Resolve thread (ERGODIC) |
create_doc |
+1 | Create document (PLUS) |
create_spreadsheet |
+1 | Create workbook (PLUS) |
modify_sheet_values |
+1 | Write cells (PLUS) |
Doc-Thread Morphism
Documents and Gmail threads form a natural morphism:
┌─────────────────────────────────────────────────────────────────┐
│ Doc-Thread Morphism │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Document ◀─────────────▶ Thread │
│ ├─ doc_id ├─ thread_id │
│ ├─ published ├─ saturated │
│ └─ all_comments_resolved └─ needs_action │
│ │
│ Functorial mapping: │
│ F(doc) = thread where doc shares via gmail │
│ F(comment) = message in review workflow │
│ F(resolve) = archive/reply │
│ │
└─────────────────────────────────────────────────────────────────┘
Workflow Paths
# Doc → Email (share for review)
share_path = doc_read >> email_compose # -1 + 1 = 0 ✓
# Email feedback → Doc update
feedback_path = email_read >> doc_modify >> comment_resolve
# -1 + 0 + 0 = -1 (needs PLUS balance)
balanced = feedback_path >> doc_export # -1 + 1 = 0 ✓
Saturation Detection
Saturation occurs when all comments are resolved:
def is_saturated(doc_id: str) -> bool:
"""Document is saturated when:
1. All comments resolved (no open threads)
2. GF(3) cycle closure: sum(trits) ≡ 0 (mod 3)
3. Published state stable
"""
comments = get_all_comments(doc_id)
all_resolved = all(c.resolved for c in comments)
cycle_sum = sum(c.trit for c in comments)
return all_resolved and (cycle_sum % 3) == 0
ANIMA Detection
def detect_anima(doc_ids: List[str]) -> Dict:
"""System at ANIMA when:
1. All documents saturated (comments resolved)
2. All spreadsheets consistent (no dirty cells)
3. GF(3) conserved globally
"""
return {
"at_anima": all_docs_saturated and all_sheets_clean,
"condensed_fingerprint": sha256(all_content_hashes),
"published_count": sum(1 for d in docs if d.published),
}
Published Document as ANIMA: When all comments are resolved and document is published, it's in condensed equilibrium.
Source Files
| File | Description | Trit |
|---|---|---|
| docs_acset.py | ACSet schema + comment tracking | 0 |
| sheet_saturation.py | Cell dirty state + formula deps | 0 |
| doc_thread_morphism.py | Functorial Doc↔Gmail mapping | 0 |
Workflows
Workflow 1: Document Review to Saturation
from docs_acset import DocsACSet
acset = DocsACSet("user@gmail.com")
# MINUS: Read document and comments
doc = acset.get_doc_content(doc_id) # trit=-1
comments = acset.read_document_comments(doc_id) # trit=-1
# ERGODIC: Process each comment
for comment in comments:
acset.reply_to_document_comment(doc_id, comment.id, "Addressed")
acset.resolve_document_comment(doc_id, comment.id) # trit=0
# PLUS: Export final version
acset.export_doc_to_pdf(doc_id) # trit=+1
# GF(3): -1 + -1 + 0 + 1 = -1 (needs one more PLUS)
Workflow 2: Spreadsheet Update Cycle
# MINUS: Read current state
values = acset.read_sheet_values(ss_id, "A1:Z100") # trit=-1
# PLUS: Write updates
acset.modify_sheet_values(ss_id, "A1:B10", new_data) # trit=+1
# ERGODIC: Add new sheet for audit
acset.create_sheet(ss_id, "Audit Log") # trit=0
# GF(3): -1 + 1 + 0 = 0 ✓
Workflow 3: Cross-Document Sync
# Read source doc
source = acset.get_doc_content(source_id) # -1
# Create target from template
target = acset.create_doc("Derived Document", source.content) # +1
# Link via comment
acset.create_document_comment(target.id, f"Derived from {source_id}") # +1
# Balance needed: -1 + 1 + 1 = 1 → add MINUS
acset.read_document_comments(target.id) # -1 → total = 0 ✓
Integration with Other Skills
| Skill | Trit | Integration |
|---|---|---|
| google-workspace | 0 | MCP tool provider |
| gmail-anima | 0 | Thread↔Doc morphism |
| gay-mcp | +1 | SplitMixTernary RNG |
| sheaf-cohomology | -1 | Section consistency |
| acsets-algebraic-databases | 0 | Schema foundation |
GF(3) Triadic Conservation
docs-acset (0) ⊗ gmail-anima (0) ⊗ sheaf-cohomology (-1) + gay-mcp (+1) = 0 ✓
read (-1) ⊗ modify (0) ⊗ create (+1) = 0 ✓
comment (-1) ⊗ reply (0) ⊗ resolve (0) + export (+1) = 0 ✓
Skill Name: docs-acset
Type: Document Management / ACSet Framework
Trit: 0 (ERGODIC - coordinator)
GF(3): Conserved via verb typing
ANIMA: Published Document = Condensed State
Scientific Skill Interleaving
This skill connects to the K-Dense-AI/claude-scientific-skills ecosystem:
Annotated Data
- anndata [○] via bicomodule
Bibliography References
general: 734 citations in bib.duckdb
SDF Interleaving
This skill connects to Software Design for Flexibility (Hanson & Sussman, 2021):
Primary Chapter: 10. Adventure Game Example
Concepts: autonomous agent, game, synthesis
GF(3) Balanced Triad
docs-acset (+) + SDF.Ch10 (+) + [balancer] (+) = 0
Skill Trit: 1 (PLUS - generation)
Secondary Chapters
- Ch7: Propagators
- Ch3: Variations on an Arithmetic Theme
- Ch6: Layering
- Ch1: Flexibility through Abstraction
Connection Pattern
Adventure games synthesize techniques. This skill integrates multiple patterns.
Cat# Integration
This skill maps to Cat# = Comod(P) as a bicomodule in the equipment structure:
Trit: 0 (ERGODIC)
Home: Prof
Poly Op: ⊗
Kan Role: Adj
Color: #26D826
GF(3) Naturality
The skill participates in triads satisfying:
(-1) + (0) + (+1) ≡ 0 (mod 3)
This ensures compositional coherence in the Cat# equipment structure.
Related Skills
Dbt Transformation Patterns
Master dbt (data build tool) for analytics engineering with model organization, testing, documentation, and incremental strategies. Use when building data transformations, creating data models, or implementing analytics engineering best practices.
Clinical Decision Support
Generate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug develo
Dask
Parallel/distributed computing. Scale pandas/NumPy beyond memory, parallel DataFrames/Arrays, multi-file processing, task graphs, for larger-than-RAM datasets and parallel workflows.
Scikit Survival
Comprehensive toolkit for survival analysis and time-to-event modeling in Python using scikit-survival. Use this skill when working with censored survival data, performing time-to-event analysis, fitting Cox models, Random Survival Forests, Gradient Boosting models, or Survival SVMs, evaluating survival predictions with concordance index or Brier score, handling competing risks, or implementing any survival analysis workflow with the scikit-survival library.
Scientific Schematics
Create publication-quality scientific diagrams using Nano Banana Pro AI with smart iterative refinement. Uses Gemini 3 Pro for quality review. Only regenerates if quality is below threshold for your document type. Specialized in neural network architectures, system diagrams, flowcharts, biological pathways, and complex scientific visualizations.
Mermaid Diagrams
Comprehensive guide for creating software diagrams using Mermaid syntax. Use when users need to create, visualize, or document software through diagrams including class diagrams (domain modeling, object-oriented design), sequence diagrams (application flows, API interactions, code execution), flowcharts (processes, algorithms, user journeys), entity relationship diagrams (database schemas), C4 architecture diagrams (system context, containers, components), state diagrams, git graphs, pie charts,
Polars
Fast DataFrame library (Apache Arrow). Select, filter, group_by, joins, lazy evaluation, CSV/Parquet I/O, expression API, for high-performance data analysis workflows.
Diagram Generation
Mermaid diagram generation for architecture visualization, data flow diagrams, and component relationships. Use for documentation, PR descriptions, and architectural analysis.
Scikit Survival
Comprehensive toolkit for survival analysis and time-to-event modeling in Python using scikit-survival. Use this skill when working with censored survival data, performing time-to-event analysis, fitting Cox models, Random Survival Forests, Gradient Boosting models, or Survival SVMs, evaluating survival predictions with concordance index or Brier score, handling competing risks, or implementing any survival analysis workflow with the scikit-survival library.
Dask
Distributed computing for larger-than-RAM pandas/NumPy workflows. Use when you need to scale existing pandas/NumPy code beyond memory or across clusters. Best for parallel file processing, distributed ML, integration with existing pandas code. For out-of-core analytics on single machine use vaex; for in-memory speed use polars.
