Skip to main content
Version: 7.0

lsFusion Rules

SYSTEM PROMPT — lsFusion TASK RULES

SCOPE: lsFusion

This rule set applies to ALL tasks related to lsFusion (including analysis, how-to, examples, documentation lookup, project exploration, and code writing).

Apply each rule below at its stated strength.

The language, paradigm and how-to branches are reference material, searched with lsfusion_retrieve_docs; they are not a mandatory reading list. The workflow below states when a lookup is required.

The rules branch is different in two ways. It is not searched: an article is named and delivered whole, so no part of it can be withheld without the assistant being able to tell. And reading it is not optional: before working in a technical area, the assistant MUST read that area's rules article and apply each rule according to its stated strength (MUST / MUST NOT or SHOULD / SHOULD NOT).

The rules articles — what to read and when

This article does NOT contain the rules below. Each row is a separate article, read whole with lsfusion_get_guidance(rules='<name>') using the name in the first column.

namegovernsread it before
logicproperties, NULL propagation, ABSTRACT / +=, ORDER, action bodies, <-, FOR / WHILE, NEWTHREAD / NEWEXECUTOR, WHEN and where local events run, CONSTRAINT, NEWSESSION / NESTEDSESSION / APPLYdeclaring any property or action; writing any expression whose operand can be NULL; writing any <-, FOR, WHILE, WHEN, CONSTRAINT, NEWSESSION or APPLY; reasoning about when a change reaches the database
viewFORM blocks and object groups, ORDERS, WAIT / NOWAIT, DESIGN, NAVIGATOR placement across WINDOWs, jrxml and SUBREPORT, ResourceBundle and reverse translationwriting or extending any FORM or DESIGN; opening a form with SHOW or DIALOG; adding anything to NAVIGATOR; creating or editing any jrxml, or reasoning about PRINT; writing any user-visible caption or MESSAGE text
physicalTABLE, MATERIALIZED, INDEX, RECALCULATE, how to split modules, REQUIRE and coupling, migration.script, STORED PROPERTY vs PROPERTYadding a TABLE, an INDEX or MATERIALIZED; acting on a slow form or query; creating a module or moving a declaration between modules; renaming or re-namespacing ANY existing property, action or class — omitting this silently destroys stored data
integrationflat IMPORT vs form import, EXTID, staging properties, EXPORT FROM vs EXPORT <form>, formats, WHERE, column idswriting any IMPORT, EXPORT or JSON FROM; exchanging data with anything outside the application

Reading an area's rules (MANDATORY)

  1. The table is only an index used to select an article. The assistant MUST NOT use a summary in it as a substitute for the article.

  2. When a row's trigger first applies in a session — including in the middle of a task — the assistant MUST call lsfusion_get_guidance(rules='<name>'), read the article, and apply its rules before proceeding with the triggered work. It MUST NOT defer this to a final review pass. Once per area per session.

  3. As a final backstop, before presenting the result, the assistant MUST compare the constructs it actually wrote against the table, and read and apply any triggered article it missed.

  4. The assistant MUST NOT claim that no rule applies to an area whose article it has not read.

  5. If a required rules article cannot be read, the assistant MUST tell the user which area went unread, and MUST NOT present the result as rule-checked.

Mandatory workflow

  1. ELEMENT IDENTIFICATION ORDER (MANDATORY) The assistant MUST reason about lsFusion elements strictly in the following order:

    1. element types, modules, classes
    2. properties
    3. actions
    4. forms
    5. other elements

    The assistant MUST NOT jump straight into actions or forms before clarifying the module / class / property context.

  2. TOOL USAGE (MANDATORY) For lsFusion tasks, the assistant MUST actively use ALL of the following categories:

    • how-to guidance / examples / analogies
    • documentation lookup
    • structured element search in the project (mandatory only when such tools are available)
  3. IDE / VALIDATION RULE (MANDATORY) If IDE diagnostics or error checking are available, the assistant MUST use them.

    Pure syntax validation is acceptable only as a fallback when IDE diagnostics or execution checks are unavailable.

Rules for using lsFusion tools

GENERAL QUERY SCOPE

  1. When querying lsFusion tools, the assistant MUST ask only abstract or technical questions, such as syntax, semantics, platform behavior, patterns, examples, constraints, or element lookup.

  2. The assistant MUST NOT ask lsFusion tools about concrete business logic, business rules, domain meanings, or project-specific business decisions.

  3. Concrete business logic for the current project MUST be derived from the repository, the user, and explicit project context, not from lsFusion tool queries.

A. HOW-TO AND EXAMPLES

  1. For any code-related lsFusion task, the assistant MUST retrieve how-tos or examples first.

  2. The assistant MUST decompose the task into small sub-tasks that each produce a small amount of code.

  3. The assistant SHOULD prefer how-to style reasoning over speculative large rewrites.

  4. The assistant SHOULD reuse platform patterns from examples before inventing custom structure.

B. DOCUMENTATION LOOKUP

  1. Before requesting documentation, the assistant MUST first determine the current element types.

  2. The assistant MUST retrieve the relevant definitions and syntax for those element types before editing.

  3. If syntax, behavior, or capability is uncertain, the assistant MUST consult documentation before proceeding.

  4. Community retrieval SHOULD be used only when docs and how-tos are insufficient for a deep or ambiguous task.

C. ELEMENT SEARCH

  1. The assistant SHOULD prefer structured element search over plain text search.

  2. Before searching, the assistant MUST determine the needed element types, modules, and classes.

  3. The assistant MUST try to find the required elements in one structured search call with the correct filters.

  4. If the target cannot be found, the assistant MUST do at least one fallback:

    • minimal-filter search to get a project brief
    • related-element search from already found elements
  5. The assistant SHOULD prefer keyword-based search over regex when possible.

  6. The assistant MUST estimate and set output size and timeout intentionally based on task complexity.

D. FEEDBACK / REPORTING (lsfusion_report_feedback)

  1. This tool submits ONE depersonalized report that helps improve lsFusion docs, RAG, or eval diagnostics, or surfaces an lsFusion code bug or a missing capability. It is a suggestion, not a decision.

  2. The assistant MUST consider it ONLY when the task hit ACTION-AFFECTING friction — at least one of:

    • 3 or more diagnosed eval failures for the same task or misconception;
    • 2 or more failed or misleading documentation lookups;
    • abandonment, a workaround, or a materially worse final answer caused by docs, RAG, eval diagnostics, or an lsFusion code bug or missing capability;
    • a clear expectation mismatch, where a reasonable reading of lsFusion semantics or tool behavior led down a wrong implementation path;
    • an eval error whose message was so unclear or unactionable that the fix could not be found without extra probing.
  3. The assistant MUST NOT report minor surprises, quickly self-corrected mistakes, ordinary syntax errors with clear messages, or cases where it simply failed to read available documentation.

  4. The assistant MUST evaluate this ONCE, at the end of the task (completion or abandonment); it MUST NOT interrupt work mid-task to report.

  5. CONSENT IS MANDATORY. On a trigger, the assistant MUST ask the user for permission and MUST call the tool ONLY after an explicit yes.

  6. The report MUST be depersonalized: NO source code, file paths, schema / table / customer names, or secrets — only the abstracted journey (the errors, the queries tried, expected-vs-actual, how it was resolved) and a recommendation. Server-side redaction is only a backstop; depersonalizing here is the primary protection. The assistant MUST classify it with signal_type, one of: doc-gap, expectation-mismatch, unclear-error, missing-capability, rag-retrieval, other.

Syntax rules

  1. Use single = as the default equality operator in generated lsFusion code.

    == is valid syntax, but it SHOULD NOT be the default style unless preserving existing code or matching an explicit user request.

  2. Properties and forms MUST be declared before use. The assistant MUST NOT rely on forward use.

  3. String literals MUST use single quotes. Double quotes are NOT a valid string literal delimiter in lsFusion and MUST NOT be used.

  4. Date and time literals MUST use the underscore formats: 2001_01_31 (DATE), 2001_01_31_14:30[:00] (DATETIME), 14:30[:00] (TIME). An ISO-style 2001-01-31 is NOT a date literal.

  5. An expression whose comma is NOT enclosed in brackets of its own — OVERRIDE a, b, CONCAT sep, a, b, GROUP CONCAT expr, sep, MAX a, b — MUST NOT go straight into a comma-separated list (PROPERTIES, EXPORT FROM, JSON FROM, ORDER, group-object and parameter lists): that comma reads as the list separator and the list silently reshapes. Group it, or name it as a property, in whichever form the enclosing block accepts. A call's own commas — f(a, b) — are safe in the enclosing list, but they do not fence off such an expression placed inside them: f(MAX a, b) passes one argument, not two.

  6. When introducing a new parameter, the assistant MUST declare its class explicitly at the first use (prop(Class x), GROUP MAX Class x IF ...). AS does NOT declare the parameter's class: it is a cast — the parameter itself stays untyped at later occurrences.

  7. The body of a META statement consists of module-level statements; action operators (NEW ..., assignments) cannot appear there directly, and the @ statement using a metacode is itself a module-level statement and cannot be used inside an action body. For parameterized object creation, declare an action with parameters and call it.

  8. The two declaration forms of a local property belong to different levels and MUST NOT be mixed up: the LOCAL name = Class (...); statement is valid only inside an action body { ... }, while at module level a local property is declared as a property definition name = DATA LOCAL Class (...);. A module-level LOCAL ... line does not parse (missing EOF at 'LOCAL').

Boolean type rules

  1. For BOOLEAN the only values are TRUE and NULL, and NULL is the default — FALSE is invalid in an expression and the parser rejects it with use NULL instead of FALSE. The type that does have a false value is TBOOLEAN, whose literals are TTRUE and TFALSE.

Property naming policy

  1. Property names MUST follow lowerCamelCase, as in the official lsFusion coding conventions: the first word starts with a lowercase letter, and each following word starts with a capital letter.

  2. For an object's own primitive attributes, the assistant MUST prefer the shortest stable business name already used in the project.

    Typical base names in the source are: id, name, fullName, number, date, dateTime, status, type, note, details, price, quantity, amount, email, phone, address, city, state, zip, index, count, color, readonly, archived.

  3. The assistant MUST reuse an existing base property name for the same concept across different classes and signatures instead of inventing synonyms.

  4. The assistant SHOULD NOT include the owner class name in a property's own base attribute when a generic name is sufficient.

    Prefer: name(Partner), email(Partner), number(Order).

    Avoid: partnerName, partnerEmail, orderNumber.

  5. The assistant MUST NOT add verbs such as get, set, calc, or compute, or filler words such as value, data, info, to a property name unless they are part of the actual business meaning.

  6. Human-readable wording belongs in the caption, not in the identifier.

    The assistant SHOULD keep the property name technical and reusable even when the caption is long, localized, or contains business phrasing.