Solving an autonomous ODE with discontinuous right hand side

I am trying to solve the following ODE, which looks very simple but it has discontinuous RHS.

$$\dot{x}(t)=-x+f(x)$$ where $$f(x)=\begin{cases}1 \quad\text{ if } x>c \\ 0 \quad\text{ if } x<c \\ z \quad\text{ if } x=c\end{cases}$$ where $z$ is a constant between $0$ and $1$. The initial condition is $x(0)=0$.

So first, I don't know there is a unique solution to this ODE. Second, how to solve this ODE? I have an approach, which is: I use a piece-wise linear Lipschitz continuous function $g$ to approximate this $f$, then I solve for $\dot{x}(t)=-x+g(x)$, then I let $g$ goes to $f$, to see the limit of the solution to $\dot{x}(t)=-x+g(x)$, then I claim this is the solution to $\dot{x}(t)=-x+f(x)$. This makes sense intuitively, but I was wondering how to make this rigorous, I guess eventually, I need to first know whether $\dot{x}(t)=-x+f(x)$ has unique solution and another question is, if I use a different continuous function $g_1$ which is not $g$, to approximate $f$, then via the same limiting procedure, will I get a different limit?

To make a rigorous argument, you need a rigorous definition of solution. One cannot expect $x(t)$ to be differentiable at every point. But then in what sense does $\dot x = -x+f(x)$ hold? A typical answer is:
$x$ is a solution if it is an absolutely continuous function and $\dot x = -x+f(x)$ holds for almost every $t$.
You don't really need an approximation of $f$: it suffices to show that $x(t)=c$ happens only for finitely many $c$, and therefore the standard uniqueness theorem, used on the intervals where $x(t)\ne c$, yields uniqueness.
Actually, there is an exceptional case when $z=c$: then there is a constant solution $x(t)\equiv c$. In this case uniqueness may fail if a solution reaches this equilibrium: it sit there $x=c$ for an arbitrary period of time, and then spontaneously depart. (This makes a Lipschitz function, a perfectly reasonable solution).
If $z\ne c$, the point of discontinuity is not an equilibrium, so solution pass it right away; in particular they are not influenced by the value of $z$ at all. I suggest drawing the phase line like for any other autonomous ODE: it will make the behaviour of solutions immediately clear.
• Actually, existence and uniqueness fails if $0 < c < 1$. With initial condition $x(0) = c$ you have solutions $x(t) = 1 + (c-1) e^{-t}$ and $x(t) = c e^{-t}$ for $t > 0$, but no solution for $t < 0$. – Robert Israel Nov 22 '15 at 8:12
• Right, but initial condition in the OP is $x(0)=0$. – user147263 Nov 22 '15 at 8:15