5.4 KiB
Getting Started with Madomeda
Prerequisites
- Python 3.7+
- Git repository with markdown files
- (Optional) OpenAI-compatible API for LLM features
Installation
-
Clone or download the Madomeda repository
-
Install dependencies:
pip install -r requirements.txt -
(Optional) Configure LLM: Edit
.envfile:OPENAI_API_URL=https://api.openai.com/v1 OPENAI_MODEL=gpt-4 OPENAI_API_KEY=your-actual-api-key
Your First Run
-
Navigate to your markdown repository:
cd /path/to/your/markdown/repo -
Run in dry-run mode to see what would change:
python /path/to/madomeda/madomeda.py --whatif -
Review the output - it will show:
- Files discovered
- Existing frontmatter (if any)
- Proposed changes
- Warnings about discarded metadata
-
Run for real if you're happy with the changes:
python /path/to/madomeda/madomeda.py -
Check the results:
- Open modified markdown files
- Review
madomeda_changelog.txt - Inspect database:
python /path/to/madomeda/inspect_db.py madomeda.db
Understanding the Output
Already Conformant
Processing: example.md
Found existing frontmatter
OK Already conformant
Meaning: File has correct frontmatter, no changes needed.
Will Update
Processing: example.md
Found existing frontmatter
WARNING Metadata will be discarded: CustomField
Would update frontmatter:
Changes: +created, +authors, -CustomField
Meaning: File will be updated. Custom fields not in template will be removed.
No Frontmatter
Processing: example.md
No frontmatter found
Would update frontmatter:
Changes: +title, +created, +changed, +authors, +version, +tags
Meaning: New frontmatter will be added.
Common Workflows
Preview Changes
python madomeda.py --whatif
Process Specific Directory
python madomeda.py --dir ~/Documents/wiki
Skip Confirmations
python madomeda.py --no-confirm
Ignore Certain Paths
python madomeda.py --ignore-paths archive drafts templates
Force Regeneration
python madomeda.py --force
Use Custom Template
python madomeda.py --template minimal
(First create templates/minimal.json)
Customization
Create Custom Template
-
Create
templates/mytemplate.json:{ "title": "heur|orig", "date": "heur|orig", "tags": "orig|ai default", "author": "heur|orig" } -
Use it:
python madomeda.py --template mytemplate
Add Custom Rule
-
Create
rules/my_rule.json:{ "name": "my_custom_rule", "description": "Description of what this rule does", "type": "custom" } -
Implement logic in
core/rules.py(requires code modification)
Customize LLM Prompt
-
Create
prompts/custom.txt:You are a documentation expert. Analyze the content and suggest metadata... -
Reference in template:
{ "summary": "ai custom" }
Troubleshooting
"Not a git repository"
Solution: Ensure you're in a directory with .git/ folder or use --dir to specify one.
"Module not found"
Solution: Run pip install -r requirements.txt
"LLM error: 401"
Solution:
- Update
.envwith valid API key - Or ensure template doesn't require
aistrategy - The tool works fine without LLM using
heurandorigstrategies
"Metadata will be discarded"
Solution:
- Review the warning
- Add fields to template if you want to keep them
- Use
--no-confirmto auto-accept - Press 'n' to skip that file
Database locked
Solution: Close any programs accessing madomeda.db
Best Practices
- Always test first: Use
--whatifbefore making changes - Commit before processing: Ensure you can revert if needed
- Review warnings: Check what metadata will be lost
- Customize templates: Match your needs, not defaults
- Version control: Commit the database to track history
- Regular runs: Process new files as they're added
Files Generated
madomeda.db- SQLite database (gitignored by default)madomeda_changelog.txt- Change logtemplates/- Created if missingrules/- Created if missingprompts/- Created if missing
Getting Help
-
Check documentation:
README.md- OverviewUSAGE.md- Detailed examplesSTRUCTURE.md- ArchitectureIMPLEMENTATION.md- Technical details
-
Inspect database:
python inspect_db.py -
Review changelog:
cat madomeda_changelog.txt
Example Session
# Navigate to your repo
cd ~/my-knowledge-base
# First run (dry run)
python ~/tools/madomeda/madomeda.py --whatif
# Output shows what will change
# Review and decide
# Run for real
python ~/tools/madomeda/madomeda.py
# Check results
cat madomeda_changelog.txt
git diff
# Commit changes
git add .
git commit -m "Normalize frontmatter with Madomeda"
Tips
- Start with
--whatifalways - Use
--no-confirmfor batch processing - Keep
madomeda.dbto track history - Review
madomeda_changelog.txtafter runs - Create templates for different doc types
- Tags are automatically collected and normalized
Success!
If you see:
Processing complete!
Total unique tags in repository: X
You're done! Your frontmatter has been normalized and tracked.