home / skills / plurigrid / asi / drive-acset

drive-acset skill

/skills/drive-acset

This skill helps you manage Google Drive with GF(3) routing to organize files and permissions into a condensed, efficient Drive ACSet.

npx playbooks add skill plurigrid/asi --skill drive-acset

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
8.8 KB
---
name: drive-acset
description: Google Drive management via DriveACSet schema with GF(3) triadic routing. Transforms files/folders into typed Interactions, routes to queue fibers, detects saturation for organized-drive-as-condensed-state.
---

# Drive ACSet Skill

Transform Google Drive into a GF(3)-conserving algebraic database system.

**Trit**: 0 (ERGODIC - coordinator)  
**Principle**: Organized Drive = Condensed State  
**Implementation**: DriveACSet + TriadicQueues + SaturationDetector

## DriveACSet Schema

```
┌────────────────────────────────────────────────────────────────────┐
│                       DriveACSet Schema                            │
├────────────────────────────────────────────────────────────────────┤
│                                                                    │
│  File ──────────┬────▶ Folder                                     │
│  ├─ file_id     │      ├─ folder_id: String                       │
│  ├─ name        │      ├─ name: String                            │
│  ├─ mime_type   │      └─ parent ─────────▶ Folder (self-ref)     │
│  ├─ size        │                                                  │
│  └─ parent ─────┘                                                  │
│                                                                    │
│  Permission ────┬────▶ File | Folder                              │
│  ├─ role        │      ├─ reader | commenter | writer | owner     │
│  └─ share_with ─┼──▶   └─ email | domain | anyone                 │
│                 │                                                  │
│  Revision ──────┼────▶ File                                       │
│  ├─ rev_id      │      ├─ modified_time                           │
│  └─ modified_by ┘      └─ keep_forever: Bool                      │
│                                                                    │
│  QueueItem ─────┼────▶ Agent3                                     │
│  ├─ interaction │      ├─ fiber: Trit {-1, 0, +1}                 │
│  └─ agent ──────┘      └─ name: String                            │
└────────────────────────────────────────────────────────────────────┘
```

### Objects

| Object | Description | Trit Role |
|--------|-------------|-----------|
| `File` | Drive file with metadata | Data |
| `Folder` | Hierarchical container | Aggregate |
| `Permission` | ACL entry for sharing | Edge |
| `Revision` | File version history | Temporal |
| `Agent3` | Queue fiber (MINUS/ERGODIC/PLUS) | Router |
| `QueueItem` | Links Interaction → Agent3 | Edge |

## GF(3) Verb Typing

Drive operations assigned trits by information flow:

```python
VERB_TRIT_MAP = {
    # MINUS (-1): Read/Validate
    "get": -1,        "search": -1,    "list": -1,
    "download": -1,   "get_content": -1,
    
    # ERGODIC (0): Coordinate/Permissions
    "share": 0,       "permissions": 0, "move": 0,
    "rename": 0,      "update_metadata": 0,
    
    # PLUS (+1): Create/Execute
    "create": +1,     "upload": +1,    "copy": +1,
    "export": +1,     "transfer_ownership": +1,
}
```

### MCP Tool → Trit Mapping

| Tool | Trit | Description |
|------|------|-------------|
| `search_drive_files` | -1 | Search files (MINUS) |
| `get_drive_file_content` | -1 | Read file (MINUS) |
| `list_drive_items` | -1 | List folder (MINUS) |
| `get_drive_file_permissions` | -1 | Check perms (MINUS) |
| `share_drive_file` | 0 | Share file (ERGODIC) |
| `update_drive_permission` | 0 | Modify perms (ERGODIC) |
| `update_drive_file` | 0 | Update metadata (ERGODIC) |
| `create_drive_file` | +1 | Create file (PLUS) |
| `transfer_drive_ownership` | +1 | Transfer owner (PLUS) |

## Triadic Queue Routing

```
                    ┌─────────────────────────────────────────┐
                    │         DRIVE TRIADIC QUEUES            │
                    ├─────────────────────────────────────────┤
                    │                                         │
   DriveAction ────▶│  route(trit) ───▶ Agent3 Fiber         │
                    │                                         │
                    │  MINUS (-1)  ────▶ [get, search, list]  │
                    │  ERGODIC (0) ────▶ [share, permissions] │
                    │  PLUS (+1)   ────▶ [create, upload]     │
                    │                                         │
                    └─────────────────────────────────────────┘
```

## Saturation Detection

```python
def is_drive_saturated(folder_id: str) -> bool:
    """Folder saturated when:
    1. All files have stable permissions
    2. No pending changes in window N
    3. GF(3) cycle closure: sum(trits) ≡ 0 (mod 3)
    """
    history = detector.history[folder_id][-N:]
    cycle_sum = sum(t for t in folder.gf3_cycle[-3:])
    
    return (
        all(s == history[0] for s in history) and
        (cycle_sum % 3) == 0
    )

def detect_organized_state() -> Dict:
    """Drive at condensed state when:
    1. All folders saturated
    2. Permission graph stable
    3. GF(3) conserved globally
    """
    return {
        "organized": all_saturated and gf3_conserved,
        "condensed_fingerprint": sha256(sorted_file_tree),
    }
```

## Source Files

| File | Description | Trit |
|------|-------------|------|
| [drive_acset.py](file:///Users/alice/agent-o-rama/agent-o-rama/src/drive_acset.py) | ACSet schema + hierarchy | 0 |
| [drive_mcp_bridge.py](file:///Users/alice/agent-o-rama/agent-o-rama/src/drive_mcp_bridge.py) | MCP tool wiring | 0 |
| [permission_graph.py](file:///Users/alice/agent-o-rama/agent-o-rama/src/permission_graph.py) | ACL graph analysis | -1 |

## Workflows

### Workflow 1: Organize Folder to Condensed State

```python
from drive_mcp_bridge import create_drive_bridge
from drive_acset import DriveACSet

bridge = create_drive_bridge("[email protected]")
acset = DriveACSet()

# MINUS: List and analyze
items = bridge.list_drive_items(folder_id="root")
for item in items:
    acset.add_file(item) if item.is_file else acset.add_folder(item)

# ERGODIC: Normalize permissions
for file in acset.files_needing_permission_fix():
    bridge.share_drive_file(file.id, share_with="[email protected]", role="reader")

# PLUS: Create missing structure
bridge.create_drive_file(file_name="README.md", folder_id=folder_id, content="# Index")
```

### Workflow 2: Permission Audit with GF(3) Guard

```python
# MINUS: Check permissions
perms = bridge.get_drive_file_permissions(file_id)

# ERGODIC: Update if needed (requires prior MINUS)
if needs_update(perms):
    bridge.update_drive_permission(file_id, permission_id, role="commenter")

# Verify GF(3) balance
assert acset.gf3_residue() == 0
```

### Workflow 3: Batch File Organization

```python
batch = create_triadic_batch(
    payloads=["list_root", "share_docs", "create_index"],
    folder_id="team_folder",
    seed=1069
)

for interaction in batch:
    system.enqueue(interaction)

stats = system.full_statistics()
print(f"GF(3) Residue: {stats['gf3_residue']}")  # 0
```

## Integration with Other Skills

| Skill | Trit | Integration |
|-------|------|-------------|
| [google-workspace](file:///Users/alice/.claude/skills/google-workspace/SKILL.md) | 0 | MCP tool provider |
| [gmail-anima](file:///Users/alice/agent-o-rama/agent-o-rama/.agents/skills/gmail-anima/SKILL.md) | 0 | Cross-product via attachments |
| [gay-mcp](file:///Users/alice/.agents/skills/gay-mcp/SKILL.md) | +1 | SplitMixTernary RNG |
| [sheaf-cohomology](file:///Users/alice/.claude/skills/sheaf-cohomology/SKILL.md) | -1 | H¹ obstruction on folder tree |

### GF(3) Triadic Conservation

```
drive-acset (0) ⊗ search (-1) ⊗ create (+1) = 0 ✓
get (-1) ⊗ share (0) ⊗ upload (+1) = 0 ✓
list (-1) ⊗ permissions (0) ⊗ copy (+1) = 0 ✓
```

---

**Skill Name**: drive-acset  
**Type**: File Management / ACSet Framework  
**Trit**: 0 (ERGODIC - coordinator)  
**GF(3)**: Conserved via triadic queue routing  
**Principle**: Organized Drive = Condensed State

Overview

This skill transforms Google Drive into an algebraic, triadic management layer using the DriveACSet schema and GF(3) trit typing. It converts files, folders, permissions, and revisions into typed Interactions, routes them into three fiber queues, and detects when folders reach an organized (condensed) state. The goal is predictable, auditable drive organization with GF(3) conservation as a guardrail.

How this skill works

Drive actions are mapped to trits (MINUS -1, ERGODIC 0, PLUS +1) and turned into QueueItems bound to Agent3 fibers. A triadic router dispatches reads, coordination/permission tasks, and create/modify tasks into separate queues. A saturation detector inspects recent history and GF(3) cycle closure to mark folders as saturated and produce a condensed fingerprint for the organized-drive state.

When to use it

  • Automate large-scale Drive reorganizations while ensuring permission stability and auditability.
  • Perform permission normalization across team folders with a clear read→verify→update workflow.
  • Enforce operation sequencing where reads must precede permission changes to avoid race conditions.
  • Monitor folder stability and trigger maintenance only when GF(3) conservation indicates safe closure.
  • Batch apply create/share/list operations with triadic routing to avoid queue saturation.

Best practices

  • Run MINUS (read/list) probes before ERGODIC (permission) changes to gather authoritative state.
  • Use the triadic queue to separate IO-heavy reads from write-heavy create/update tasks.
  • Tune the saturation detection window N to your activity cadence to avoid false positives.
  • Keep permission normalization idempotent; treat repeated ERGODIC actions as safe coordinators.
  • Validate gf3_residue()==0 after multi-step workflows to ensure conservation.

Example use cases

  • Organize a team folder: list items, normalize permissions, then create missing index files to reach condensed state.
  • Permission audit: batch-check file ACLs (MINUS), update misconfigured entries (ERGODIC), then assert GF(3) balance.
  • Batch ingest workflow: upload documents (PLUS) into a pre-normalized folder and let the triadic router balance load.
  • Automated maintenance: detect saturated folders and generate an immutable condensed_fingerprint for compliance records.

FAQ

What does GF(3) conservation mean in practice?

GF(3) conservation means operations are typed to trits and triadic sequences should sum to 0 mod 3; this guards against unbalanced mixes of reads/coordination/creates and helps detect completion cycles.

How is a folder marked as saturated?

A folder is saturated when recent history shows stable permissions, no pending changes within the configured window, and the last GF(3) cycle sums to 0 (mod 3); a condensed fingerprint is produced when all folders are saturated.