---
category: reference
tags: [tasks, future, limits]
last_updated: 2026-03-15
confidence: medium
---

# Disk Usage Cap Per Wiki

## Problem
There's no disk space limit per wiki. A user could fill the VPS disk by uploading large attachments or creating thousands of pages. The page count limit (500) doesn't account for attachment size.

## Current limits
- MAX_PAGES_PER_WIKI = 500 (enforced in ManagementMiddleware on wiki creation)
- No disk space enforcement

## Proposed cap
50MB per wiki. The dev wiki (65 pages, all markdown) is 1.4MB including git history. 50MB gives plenty of room for growth and moderate attachments.

## Enforcement options

### Option A: Per-write check
Check `du -s` on the wiki repo before each page save or attachment upload. Reject writes that would exceed the cap. Accurate but expensive — `du` on a large git repo can take hundreds of milliseconds.

### Option B: Tracked column
Add a `disk_usage` column to the wikis table. Update it after each write (or periodically). Check the column value on writes — fast but can drift from reality.

### Option C: Periodic cron
A cron job checks `du` for all wikis. If over cap, sets a flag that the TenantResolver checks on write requests. Cheap per-request but enforcement is delayed.

### Option D: Git hooks
A git pre-receive hook that checks repo size before accepting a push. Only works for git-based writes, not web UI or MCP.

## Decision needed
Which option, or a combination. Option B (tracked column) with Option C (periodic correction) is probably the right balance — fast per-request check with eventual consistency.

## Not urgent
No external users yet. Can be deferred until pre-launch (V7-9).
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9