File size: 9,275 Bytes
d821d28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?xml version="1.0" encoding="UTF-8"?>
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt">
  <sch:title>ProjectOS v2 manifest rules</sch:title>
  <sch:pattern id="manifest-shape">
    <sch:rule context="ProjectOS">
      <sch:assert test="@version = '2.0'">The manifest version must be 2.0.</sch:assert>
      <sch:assert test="count(decisionFormula/step) = 15">The decision formula must define all 15 stages.</sch:assert>
      <sch:assert test="count(decisionFormula/step[@gate = 'true']) = 2">The decision formula must include logic and governance gates.</sch:assert>
      <sch:assert test="count(projectLifecycle/stage) = 12">The project lifecycle must define all 12 stages.</sch:assert>
      <sch:assert test="count(fabrics/fabric) = 11">The manifest must define the 11 ProjectOS fabrics.</sch:assert>
      <sch:assert test="count(councils/council) = 6">The manifest must define six council templates.</sch:assert>
      <sch:assert test="count(agents/agent) = 12">The manifest must define 12 specialist agents.</sch:assert>
      <sch:assert test="count(models/model) &gt;= 1">At least one model routing entry is required.</sch:assert>
      <sch:assert test="count(workspaces/workspace) &gt;= 1">At least one workspace route is required.</sch:assert>
      <sch:assert test="count(permissions/permission) &gt;= 1">At least one permission rule is required.</sch:assert>
      <sch:assert test="normalize-space(runtime/@profile) != ''">The runtime profile must be named.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern id="catalog-quality">
    <sch:rule context="fabrics/fabric">
      <sch:assert test="normalize-space(@name) != ''">Every fabric needs a name.</sch:assert>
      <sch:assert test="normalize-space(@description) != ''">Every fabric needs a description for the dashboard.</sch:assert>
      <sch:assert test="count(capability) &gt;= 1">Every fabric must declare at least one capability.</sch:assert>
    </sch:rule>
    <sch:rule context="councils/council">
      <sch:assert test="normalize-space(@description) != ''">Every council needs a description.</sch:assert>
      <sch:assert test="count(member) &gt;= 1">Every council must assign at least one member.</sch:assert>
    </sch:rule>
    <sch:rule context="agents/agent">
      <sch:assert test="normalize-space(@description) != ''">Every agent needs a description.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern id="unique-registries">
    <sch:rule context="ProjectOS">
      <sch:assert test="count(fabrics/fabric) = count(fabrics/fabric[not(@name = preceding-sibling::fabric/@name)])">Fabric names must be unique.</sch:assert>
      <sch:assert test="count(councils/council) = count(councils/council[not(@name = preceding-sibling::council/@name)])">Council names must be unique.</sch:assert>
      <sch:assert test="count(agents/agent) = count(agents/agent[not(@name = preceding-sibling::agent/@name)])">Agent names must be unique.</sch:assert>
      <sch:assert test="count(models/model) = count(models/model[not(@role = preceding-sibling::model/@role)])">Model roles must be unique.</sch:assert>
      <sch:assert test="count(workspaces/workspace) = count(workspaces/workspace[not(@role = preceding-sibling::workspace/@role)])">Workspace roles must be unique.</sch:assert>
      <sch:assert test="count(permissions/permission) = count(permissions/permission[not(@id = preceding-sibling::permission/@id)])">Permission rule identifiers must be unique.</sch:assert>
      <sch:assert test="normalize-space(storage/@local) != '' and normalize-space(storage/@enterprise) != ''">Both local and enterprise storage targets must be named.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern id="registry-quality">
    <sch:rule context="models/model">
      <sch:assert test="normalize-space(@role) != '' and normalize-space(@provider) != ''">Each model route needs a role and provider.</sch:assert>
    </sch:rule>
    <sch:rule context="workspaces/workspace">
      <sch:assert test="normalize-space(@role) != '' and normalize-space(@name) != ''">Each workspace route needs a role and workspace name.</sch:assert>
    </sch:rule>
    <sch:rule context="permissions/permission">
      <sch:assert test="@effect = 'allow' or @effect = 'deny' or @effect = 'require-approval'">Permission effects must be allow, deny, or require-approval.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern id="logic-required">
    <sch:rule context="CouncilTemplate">
      <sch:assert test="Member[@Ref='LogicAgent']">LogicAgent required.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern id="storage-provider">
    <sch:rule context="storage">
      <sch:assert test="count(providers/provider[@enabled='true' or @enabled='1']) &gt; 0">At least one storage provider must be enabled.</sch:assert>
      <sch:assert test="count(vectorStores/vectorStore) &gt; 0">At least one vector store must be configured.</sch:assert>
      <sch:assert test="count(vectorStores/vectorStore[@provider='sqlite-vec']) = 0 or count(providers/provider[@name='SQLite' and (@enabled='true' or @enabled='1')]) &gt; 0">sqlite-vec requires the SQLite provider to be enabled.</sch:assert>
      <sch:assert test="count(vectorStores/vectorStore[@provider='pgvector']) = 0 or count(providers/provider[@name='PostgreSQL' and (@enabled='true' or @enabled='1')]) &gt; 0">pgvector requires the PostgreSQL provider to be enabled.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern id="canon-retention">
    <sch:rule context="storage/retention">
      <sch:assert test="@keepCanonForever='true' or @keepCanonForever='1'">Canon storage must be retained permanently.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern id="migration-backup">
    <sch:rule context="storage/migration">
      <sch:assert test="@autoMigrate='false' or @autoMigrate='0' or @backupBeforeMigration='true' or @backupBeforeMigration='1'">Automatic migrations require backups.</sch:assert>
      <sch:assert test="@autoMigrate='false' or @autoMigrate='0' or @validateSchema='true' or @validateSchema='1'">Automatic migrations require schema validation.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern id="symbol-registry">
    <sch:rule context="namingConventions">
      <sch:assert test="count(convention) &gt; 0">At least one canonical symbol convention is required.</sch:assert>
      <sch:assert test="count(convention/alias[. = /ProjectOS/namingConventions/convention/@canonical]) = 0">A symbol alias cannot collide with a canonical symbol name.</sch:assert>
    </sch:rule>
    <sch:rule context="convention">
      <sch:assert test="normalize-space(@canonical) != ''">Each symbol convention needs a canonical name.</sch:assert>
      <sch:assert test="count(alias) &gt; 0">Each canonical symbol needs at least one alias.</sch:assert>
    </sch:rule>
    <sch:rule context="languageProfiles/languageProfile">
      <sch:assert test="normalize-space(@name) != ''">Each language profile needs a name.</sch:assert>
      <sch:assert test="@interfacePrefix or @interfacePrefix = ''">Each language profile must define its interface prefix, which may be empty.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern id="documentation-outputs">
    <sch:rule context="documentation">
      <sch:assert test="count(output[@enabled='true' or @enabled='1']) &gt; 0">At least one documentation output must be enabled.</sch:assert>
      <sch:assert test="count(output[@name='Architecture' and (@enabled='true' or @enabled='1')]) = 1">Architecture documentation must be enabled.</sch:assert>
      <sch:assert test="count(output[@name='Bootstrap' and (@enabled='true' or @enabled='1')]) = 1">Bootstrap documentation must be enabled.</sch:assert>
      <sch:assert test="count(output[@name='Schema' and (@enabled='true' or @enabled='1')]) = 1">Schema documentation must be enabled.</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern id="mcp-registry">
    <sch:rule context="mcpServers">
      <sch:assert test="count(server) &gt; 0">At least one MCP server entry is required.</sch:assert>
      <sch:assert test="count(server) = count(server[normalize-space(@name) != ''])">Every MCP server needs a name.</sch:assert>
      <sch:assert test="count(server) = count(server[normalize-space(@adapter) != ''])">Every MCP server needs a registered adapter name.</sch:assert>
      <sch:assert test="count(server[@authMode='environment' or @authMode='keyring']) = count(server[@authMode='environment' or @authMode='keyring'][normalize-space(@credentialRef) != ''])">Environment and keyring authentication require a credential reference.</sch:assert>
      <sch:assert test="count(profiles/profile) &gt; 0">At least one MCP profile is required.</sch:assert>
    </sch:rule>
    <sch:rule context="mcpServers/profiles">
      <sch:assert test="count(profile[@name='database-write' and @enabled='true']) = 0">The database-write profile must stay disabled until a write role and approval policy are configured.</sch:assert>
      <sch:assert test="count(../server[@name='github-write' and @enabled='true']) = 0">GitHub write access must stay disabled until a write-scoped credential is configured.</sch:assert>
    </sch:rule>
  </sch:pattern>
</sch:schema>