
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 the functions $f(x)=a\ln x-x^{2}+x$ and $g(x)=(x-2)e^{x}-x^{2}+m$, where $e=2.71828\ldots$,
$(1)$ Discuss the monotonicity of the function $f(x)$ when $a\leqslant 0$.
$(2)$ When $a=-1$ and $x\in (0,1]$, $f(x) > g(x)$ always holds, determine the maximum value of positive integer $m$.

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