Skip to content

Refactor of guidelines keyword into mandate#34

Open
luca-anzalone wants to merge 3 commits into
devfrom
refactor/mandate
Open

Refactor of guidelines keyword into mandate#34
luca-anzalone wants to merge 3 commits into
devfrom
refactor/mandate

Conversation

@luca-anzalone

Copy link
Copy Markdown
Contributor

Description

Renames the NXS language keyword guidelines to mandate across the full stack (grammar, parser, AST nodes, runtime, internal prompts, tests, examples, and docs). The old keyword is kept as a deprecated alias for backward compatibility, which will be removed in a future version.

Type of change

  • Bug fix
  • New feature
  • Refactoring
  • Documentation
  • Other (describe below)

Solution

mandate better reflects the binding, authoritative nature of the block. The rename touches every layer:

  • Grammar (nxs_v2_grammar.lark): the deliberate rule now accepts (mandate | guidelines)?; both terminals and rules are defined, with guidelines annotated as deprecated. Using both in the same block is a grammar-level error.
  • Parser (parser.py): guidelines and __guidelines are kept as reserved words and in the TOKEN_MAP. The guidelines() transformer delegates to mandate() after emitting a DeprecationWarning: "The 'guidelines' keyword is deprecated; use 'mandate' instead.".
  • AST node (node.py): Deliberate.guidelinesDeliberate.mandate; to_nxs() always serializes as mandate: / __mandate.
  • Runtime (executor.py, coder.py, script.py, expertise.py, prompt.py): all attribute accesses, local variables, string literals, and LLM prompt templates updated.
  • Tests: all Python test fixtures and inline NXS strings updated; one new test (test_guidelines_deprecated_alias) verifies that old scripts still parse correctly, populate .mandate, and raise DeprecationWarning.
  • NXS scripts (examples, tutorials, test scripts): guidelines:mandate:, __guidelines__mandate.
  • Docs: language spec updated; deprecation notice added under the Mandate section.

Plugin changelogs were intentionally left unchanged as they are a historical record.

Testing

  • Added or updated unit/integration tests
  • All existing tests pass (pytest)

New test: test/core/test_parser.py::test_guidelines_deprecated_alias — parses a deliberate using the old guidelines: keyword and asserts:

  1. .mandate is populated correctly.
  2. A DeprecationWarning mentioning both guidelines and mandate is emitted.

Release Notes

The guidelines: / __guidelines keyword inside deliberate blocks has been renamed to mandate: / __mandate. Existing scripts using the old keyword continue to work but will emit a DeprecationWarning at parse time. Migrate by doing a find-and-replace of guidelines:mandate: and __guidelines__mandate in your .nxs files. The old keyword will be removed in a future release.

@luca-anzalone luca-anzalone added this to the Release 09/26 milestone Jul 10, 2026
@luca-anzalone luca-anzalone self-assigned this Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant