glam/.opencode/rules/archive-folder-convention.md
kempersc b13674400f Refactor schema slots and classes for improved organization and clarity
- Removed deprecated slots: appraisal_notes, branch_id, is_or_was_real.
- Introduced new slots: has_or_had_notes, has_or_had_provenance.
- Created Notes class to encapsulate note-related metadata.
- Archived removed slots and classes in accordance with the new archive folder convention.
- Updated slot_fixes.yaml to reflect migration status and details.
- Enhanced documentation for new slots and classes, ensuring compliance with ontology alignment.
- Added new slots for note content, date, and type to support the Notes class.
2026-01-14 12:14:07 +01:00

98 lines
2.8 KiB
Markdown

# Rule: Archive Folder Convention
**Rule ID**: archive-folder-convention
**Created**: 2026-01-14
**Status**: Active
## Summary
All archived files MUST be placed in an `/archive/` subfolder within their parent directory, NOT at the same level as active files.
## Rationale
1. **Clean separation**: Active files are clearly distinguished from deprecated/archived files
2. **Discoverability**: Developers can easily find current files without wading through archived versions
3. **Git history**: Archive folder can be `.gitignore`d for lightweight clones if needed
4. **Consistent pattern**: Same structure across all schema module types (slots, classes, enums)
## Directory Structure
```
modules/
├── slots/
│ ├── archive/ # Archived slot files go HERE
│ │ ├── branch_id_archived_20260114.yaml
│ │ ├── all_data_real_archived_20260114.yaml
│ │ └── ...
│ ├── has_or_had_identifier.yaml # Active slots at this level
│ └── ...
├── classes/
│ ├── archive/ # Archived class files go HERE
│ │ └── ...
│ └── ...
└── enums/
├── archive/ # Archived enum files go HERE
│ └── ...
└── ...
```
## Naming Convention for Archived Files
```
{original_filename}_archived_{YYYYMMDD}.yaml
```
**Examples**:
- `branch_id.yaml``archive/branch_id_archived_20260114.yaml`
- `RealnessStatus.yaml``archive/RealnessStatus_archived_20260114.yaml`
## Migration Workflow
When archiving a file during slot migration:
```bash
# 1. Copy to archive folder with timestamp suffix
cp modules/slots/branch_id.yaml modules/slots/archive/branch_id_archived_20260114.yaml
# 2. Remove from active location
rm modules/slots/branch_id.yaml
# 3. Update manifest counts
# (Decrement slot count in manifest.json)
# 4. Update slot_fixes.yaml
# (Mark migration as processed: true)
```
## Anti-Patterns
**WRONG** - Archived files at same level as active:
```
modules/slots/
├── branch_id_archived_20260114.yaml # NO - clutters active directory
├── has_or_had_identifier.yaml
└── ...
```
**CORRECT** - Archived files in subdirectory:
```
modules/slots/
├── archive/
│ └── branch_id_archived_20260114.yaml # YES - clean separation
├── has_or_had_identifier.yaml
└── ...
```
## Validation
Before committing migrations, verify:
- [ ] No `*_archived_*.yaml` files at module root level
- [ ] All archived files are in `archive/` subdirectory
- [ ] Archive folder exists for each module type with archived files
- [ ] Manifest counts updated to exclude archived files
## See Also
- Rule 53: Full Slot Migration (`full-slot-migration-rule.md`)
- Rule 9: Enum-to-Class Promotion (`ENUM_TO_CLASS_PRINCIPLE.md`)
- slot_fixes.yaml for migration tracking