Skip to content

English wiki

hacko223 edited this page Jul 5, 2026 · 2 revisions

DMC — Advanced Usage Guide

Dynamic Memory Chunk (DMC) is a dynamic library that lets you install specialized packages on demand. Every package in the DMC ecosystem follows the same core philosophy: compressed memory chunks — a format optimized for efficient storage, retrieval, and integrity verification of structured data.


Installation

pip install dmc

Package management

DMC pulls packages directly from the DMC-registry folder in the GitHub repository. No external registry, no configuration files — just .zip files hosted on GitHub.

# Install a package
dmc install --package "package-name"

# List installed and available packages
dmc list

# Get detailed info about a package
dmc info --package "package-name"

# Search the registry
dmc search keyword

# Update
dmc update --package "package-name"
dmc update --all

# Reinstall
dmc reinstall --package "package-name"

# Remove
dmc remove --package "package-name"

# Remove individual modules (only if they have no internal dependents)
dmc edit --package "package-name"

# Requirements
dmc freeze
dmc export --output requirements.txt
dmc import --file requirements.txt

# Download .zip without installing
dmc download --package "package-name"
dmc download --package "package-name" --export "/path/to/save/"

Python usage

DMC uses lazy loading — packages are only imported into memory when first accessed. Installing multiple packages does not mean all of them load on import dmc.

import dmc

# Only loads the package you access
dmc.package_a.SomeClass()

# Other installed packages stay unloaded until needed

Both access patterns work:

# Attribute access
import dmc
dmc.package_a.SomeClass()

# Direct import
from dmc import package_a
package_a.SomeClass()

Core philosophy — compressed memory chunks

Every DMC package stores data in chunks — discrete, compressed units of information. The format varies per package but the underlying principles are consistent across the ecosystem:

  • Compression — chunks are compressed automatically (ZLIB for recent/small data, LZMA for older/larger data)
  • Integrity — CRC32 per chunk on read; optional SHA-1 mirror block for full verification
  • Recovery — optional XOR parity blocks allow reconstruction of a damaged chunk from its group
  • Index — a flat index at the end of each file enables fast lookup without scanning the entire file
  • Sessions — chunks can be grouped by session for contextual retrieval
  • TTL — each chunk can have an expiration time; expired chunks are excluded from normal reads but preserved until explicitly purged
  • Relationships — chunks can reference a parent chunk, enabling linked structures

Integration with LLMs

DMC packages designed for LLMs store conversation history, context, and knowledge as compressed chunks. This data is injected into the prompt on each call — the LLM remains stateless, but from its perspective it has persistent memory.

import dmc
import ollama

mem = dmc.amcx.SmartMemory("chat.amcx")
mem.append("user: what did we discuss earlier?")

context = mem.get_recent(20)

response = ollama.chat(
    model="deepseek-r1",
    messages=[
        {"role": "system", "content": "\n".join(context)},
        {"role": "user",   "content": "Summarize our conversation."},
    ]
)

mem.append(f"assistant: {response['message']['content']}")
mem.flush()

Integration with AI agents

DMC packages designed for agents go beyond conversation history — they track tasks, scheduled events, tool calls, errors, and agent state across sessions.

import dmc

agent = dmc.dmc_agent_format.AgentMemory(
    "agent.dmc",
    session_id   = 1,
    use_mirror   = True,
    use_recovery = True,
)

agent.log_message("user", "Schedule a meeting tomorrow at 10am")
task_id = agent.add_task("Send meeting invites", priority=dmc.dmc_agent_format.Priority.HIGH)

import time
agent.schedule_event("Team meeting", start=int(time.time()) + 86400, location="Room A")
agent.log_tool("calendar_api", {"action": "create"}, {"event_id": "evt_123"}, success=True)
agent.set_state({"goal": "schedule meeting", "step": "waiting for confirmation"})
agent.flush()

# Next session — recover context
state  = agent.get_state()
tasks  = agent.pending_tasks()
events = agent.upcoming_events(within_seconds=86400)
tl     = agent.timeline(limit=10)

Integrity and recovery

For production use, enable mirror and recovery on any DMC package that supports it:

# SHA-1 mirror — detects modification or corruption per chunk
status = agent.verify_mirror()
if not status.all_ok:
    for problem in status.problems:
        print(f"Chunk {problem.chunk_id}: {problem.status.value}")

# XOR recovery — reconstructs a damaged chunk from its parity group
if agent.repair_chunk(damaged_chunk_id):
    print("Chunk recovered successfully.")

Packages (Usage Guide)

amcx

info amcx

This package is a clone of the AMCX library, to know how to use the lib read the wiki. to use is normally used only at the beginning use '''dmc.amcx'''


dmc_agent_format

in development