Auto-attributes (Phase 1 — metadata-only)
Version: 1.1.0 Date: 2026-07-15
Goal: Let automatic services (Tower v2, n8n, future agents) deposit structured metadata separate from manual user attributes, with smart lists ("Listes Automatiques") filtering documents dynamically by attribute codes in IP Magic Box.
Solution: New documents.autoAttributes[] field, folder type: auto, platform admin API for global catalogue and ingestion agents, universal POST /documents ingest with strict agent validation. Canonical guide: neo-backend/docs/auto-attributes.md.
Features:
POST /documents— manual (attributes) and auto (autoAttributes) metadata; optionalfileIdfor legacy upload + neo document two-step flow (n8n/Airtable)GET /documents— top-levelautoAttributescounts + per-document values;X-Mock: truefor front-first development- Platform API —
/platform/agents,/platform/auto-attribute-codes,/platform/folder-templates,/platform/companies/:id/*viaX-Platform-Admin-Token apitokens.agentread asapiTokenAgentforBcyip-Agentheader validation on ingest- Technical codes
bcyip:agentandbcyip:agent-versionauto-injected (not configurable on agents) - Idempotent ingest: merge
autoAttributesby code on duplicatehash+jobRef - Tower hall (
folder=tower): union Tower v1 tags + any agent deposit (bcyip:agentinautoAttributes, any value) - Catalogue LOV with optional
valueLabelon read paths (additive for IP Magic Box)
Schema changes:
documents.autoAttributes[]—{code, value}[]companies.folders[].type—'manual' | 'auto'companies.folders[].targetAttributeCodes[],targetAutoAttributes[],displayedCodes[]attributes.code?on global catalogue entriesagent_codescollection —agentName,allowedAttributeRefs[]auto_folder_templates— global smart-list templatesusers.agentsruntime map updated on agent deposits
Implementation Details:
buildDocumentFolderFilter()— manual ObjectId folders vs auto code filters vs Tower unionfiltersAutoAttributesTemplate— aggregation counts for filter bar- Ingestion normalizes legacy
bcyip-agent/ unprefixed codes during transition - No seed scripts — catalogue and agents managed via platform HTTP API
Files Modified:
src/domains/document/document.service.ts- Ingest validation, idempotence, folder resolversrc/domains/document/document.controller.ts-POST /documents, mock header, OpenAPIsrc/domains/document/templates/documents.ts- Folder filters, Tower hallsrc/domains/document/templates/filters_auto_attributes.ts- Filter aggregation (new)src/domains/platform/agents/- Agent CRUD (new)src/domains/platform/auto-attribute-codes/- Global catalogue (new)src/domains/platform/folder-templates/- Smart-list templates (new)src/domains/platform/companies/platform-companies.controller.ts- Cross-company ops (new)src/core/auth/auth.service.ts-apiTokenAgent,recordUserAgentRuntimesrc/shared/middleware/agent.middleware.ts- Agent telemetry on authenticated requestsdocs/auto-attributes.md- Canonical reference
Prod setup:
- Set
PLATFORM_ADMIN_TOKENon Clever Cloud - Bootstrap catalogue +
iptoweragent via/platform/* - Tag Tower API tokens with
apitokens.agent: 'iptower'(Retool) — not required for IP Magic Box manual deposit
Release fragment: feat-auto-attributes