Ypgen
Ypgen - Y-Principle Generator
ypgen (py-yprinciple-gen) is a Python-based code generator that applies the Y-Principle to automatically generate Semantic MediaWiki infrastructure from a single model definition.
- GitHub: https://github.com/WolfgangFahl/py-yprinciple-gen
- PyPI: py-yprinciple-gen
- Web UI: https://ypgen.bitplan.com
- Version: 0.5.2 (2026-02-23)
- License: Apache 2.0
The Y-Principle
The Y-Principle states: Define once, generate everything.
Instead of manually creating wiki Templates, Forms, Categories, Concepts, Properties, and Help pages for each topic, you define the data model once in a Context using the SiDIF (Simple Data Interchange Format) notation. Ypgen then generates all necessary wiki pages from that single definition.
Context (SiDIF Model)
|
ypgen
|
+--------+--------+--------+--------+--------+
| | | | | |
Template Form Category Concept Properties Help
This eliminates redundancy, ensures consistency, and makes changes propagate automatically across all generated artifacts.
How It Works
1. Define a Context
A Context is a data model defined in SiDIF notation on contexts.bitplan.com. It contains:
- Topics - The things you want to model (e.g., Agent, Mail, Scholar)
- Properties - The attributes of each topic (e.g., name, role, since)
- Metadata - Type, input type, bounds, documentation, display options
Example: The AgentContext defines the Agent topic with properties like name, role, DISC scores, etc.
Agent isA Topic
"Agent" is name of it
"Agents" is pluralName of it
"AI Assistant that performs tasks autonomously" is documentation of it
"property" is defaultstoremode of it
Agent_name addsTo it
Agent_role addsTo it
Agent_dominance addsTo it
...
2. Run ypgen
# Generate wiki infrastructure and serve the web UI
ypgen --context AgentContext --wikiId media --serve
# Or generate for a specific wiki without web server
ypgen --context AgentContext --wikiId media
Command-line options:
| Option | Default | Description |
|---|---|---|
--context CONTEXT |
MetaModel | Context to generate from |
--wikiId WIKIID |
wiki | Target wiki ID (from ~/.mediawiki-japi/ config) |
--serve |
false | Start web server for review UI |
--host HOST |
fix.bitplan.com | Host to serve from |
--port PORT |
8778 | Port to serve from |
-d |
false | Debug mode |
3. Review Generated Pages
The web UI at ypgen.bitplan.com shows all generated wiki pages side-by-side before pushing them to the target wiki. You can review:
- Template:Agent - The Semantic MediaWiki template with all properties
- Form:Agent - The form for creating/editing agent pages
- Category:Agent - The category page
- Concept:Agent - The SMW concept definition
- Property:Agent * - Individual property pages
- Help:Agent - Auto-generated help page
4. Push to Wiki
After review, the generated pages are pushed to the target wiki (e.g., media.bitplan.com). Users can then create pages using the generated templates and forms.
What Gets Generated
For each Topic in a Context, ypgen generates:
| Wiki Page | Purpose | Example |
|---|---|---|
Template:{Topic} |
Stores and displays semantic properties | Template:Agent |
Form:{Topic} |
User-friendly input form | Form:Agent |
Category:{Topic} |
Groups all instances | Category:Agent |
Concept:{Topic} |
SMW concept for querying | Concept:Agent |
Help:{Topic} |
Auto-generated documentation | Help:Agent |
Property:{Topic} {prop} |
One per property | Property:Agent name |
List of {PluralName} |
Overview/listing page | List of Agents |
Contexts at BITPlan
Contexts are managed on contexts.bitplan.com. Key contexts include:
| Context | Description | Topics |
|---|---|---|
| AgentContext | AI Agent definitions | Agent |
| MetaModel | The meta-model itself | Context, Topic, Property, ... |
See Also
- Y-Principle - The underlying design principle
- py-yprinciple-gen on wiki.bitplan.com - Technical documentation
- Semantic MediaWiki - The wiki platform