Auto-attributes (Phase 1)
Overview
Structured metadata for documents deposited by automatic services (Tower v2, n8n, future agents), separate from manual user attributes. Powers Smart Lists (Listes Automatiques) in IP Magic Box and platform ops tooling.
Canonical repo guide: neo-backend/docs/auto-attributes.md.
How it works
- Ingest:
POST /documentsrequiresBcyip-Agent. The value must matchapitokens.agent.bcyip:agentis that header;bcyip:agent-versionisBcyip-Versionwhen non-empty.fileIdis optional only foriptower; every other agent must link a RemoteFile. - Manual deposit unchanged: IP Magic Box upload stays on legacy
POST /files/upload. Creating the neo document still needs the agent header and, except for Tower, afileId. - Folder v0:
folder=towermatchesbcyip:agentagainstagent_codesrows withautomatic: true.folder=ipbis the inverse. Thebcyip-towertag is not used. Existing agents are not backfilled. - Custom folders:
companies.folders[].type=manual|auto; auto folders filter bytargetAttributeCodesortargetAutoAttributes. - Allowed codes: reads use
allowedAttributeRefsonly. Create and update still acceptallowedCodesand write refs. - Platform ops:
/platform/*routes useX-Platform-Admin-Token(PLATFORM_ADMIN_TOKENenv).
Key files
src/domains/document/document.service.ts— ingest validation, idempotence, folder resolversrc/domains/document/templates/document-folder-v0.ts— automatic vs manual folder matchsrc/domains/platform/agents/— agent CRUD,automatic,allowedAttributeRefssrc/domains/platform/auto-attribute-codes/— global catalogue + LOVsrc/core/auth/auth.service.ts—apiTokenAgentfromapitokens.agent
Technical decisions
- Separate arrays:
autoAttributes[]vsattributes[]— manual workflows untouched. - No seed scripts: catalogue and agents bootstrapped via platform API.
fileId: optional only foriptower. Other agents must link a RemoteFile uploaded by the legacy API.automaticflag: folder membership is catalogue-driven. No backfill of existing agent rows.
Known issues
- Tower tokens need
apitokens.agent: 'iptower'andagent_codes.automatic: trueor deposits stay in the manual folder. - IP Magic Box tokens need
apitokens.agentset toipmagicboxbeforePOST /documents, and afileId.
Next steps
-
GET /platform/auto-attribute-codes/:code/observed-valuesfor ops label editor - Phase 2: folder write rules, migration tooling