Skip to content

How do I write a Module?

Your connected agent can write and update Modules as useful knowledge emerges during your work. Give it your direction and corrections; with Cortex instructions and write access, it can preserve what future agents need to know and why. You can also write a Module yourself. Keep one subject together, including its constraints and reasons, without copying implementation or turning it into a work log.

Find the subject's existing Module

Flash a known target directly. Otherwise use a connected agent, the Modules view at cortex.socra.com, or keyword Search in the CLI to find related knowledge. For the CLI, use your intended Account with the Cortex plugin installed:

socra cortex module search --query "your topic"

Use socra cortex map only when Search leaves subjects or relationships unclear.

Read the full content of a possible match, reusing current knowledge already available. Retrieve content or direct Dependencies before editing only when they are missing or outdated. Update that Module when it already owns the decision. Create a new Module when the knowledge has a distinct subject that future work can retrieve independently.

State the rule, its reason, and any exception that changes how it applies. For example, a team might record that prices use integer minor units to prevent rounding errors, with a separate rule for currencies that do not use two decimal places. This is an example of useful specificity, not knowledge every Account should adopt.

Leave temporary progress, incidents, file paths, copied source, and migration status in their work records. Future agents should inspect current implementation evidence separately.

Choose Dependencies deliberately

A Dependency is knowledge needed to understand the Module every time it is Flashed. Add it for that reason, not merely because the other subject was useful during research. Cortex rejects dependency cycles.

Review the complete Flash closure before sharing the Module. Anyone allowed to Flash the requested Module receives its Dependencies in that result, including Dependencies they cannot open separately. A Dependency is therefore also a disclosure decision.

Save the knowledge

The suggested Cortex instructions tell the agent to save useful knowledge, briefly name the affected Modules, and explain what changed and why. You can ask it to show you the exact content and Dependencies for approval before saving. Your instructions and the agent host's confirmation settings are separate from the Cortex permissions that authorize a write.

For manual creation through the CLI, save the intended text in module.md in your working directory. Replace example with the chosen Module name:

socra cortex module create --name example --content-file module.md

To change the content of an existing Module while keeping its Dependencies:

socra cortex module update example --content-file module.md

Use --deps foundation,other-module only when you intend to replace the entire direct Dependency list with those existing names. Omitting --deps during an update preserves the list. A successful save response confirms the change. If a write loses its response, read the Module before repeating the write; the first request may have succeeded. A refused write requires the appropriate Module permission or correction of the reported validation error.