
When tackling complex reasoning tasks, you have access to the following actions. Use them as needed to progress through your thought process.

[ASSESS]

[ADVANCE]

[VERIFY]

[SIMPLIFY]

[SYNTHESIZE]

[PIVOT]

[OUTPUT]

You should strictly follow the format below:

[ACTION NAME]

# Your action step 1

# Your action step 2

# Your action step 3

...

Next action: [NEXT ACTION NAME]


system
Given that the terms of the sequence $\{a_{n}\}$ are all positive numbers, the sum of its first $n$ terms is $S_{n}$, the sum of the first $n$ terms of the sequence $\{{a}_{n}^{2}\}$ is $T_{n}$, and $2T_{n}={S}_{n}^{2}+2S_{n}$ for $n\in N^{*}$.  
$(1)$ Find the general formula for the sequence $\{a_{n}\}$;  
$(2)$ If for any positive integer $n$, $S_{n}-ma_{n}\geqslant n^{2}-n$, find the maximum value of the real number $m$.

Present the answer in LaTex format: \boxed{Your answer}
user